mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
Block expressions (#6695)
* enabled parsing of block expressions * added test case; closes #3827 * adjusted grammar doc strings * updated grammar in docs
This commit is contained in:
committed by
Andreas Rumpf
parent
4c7dda37a2
commit
40a6caeed8
@@ -4,7 +4,8 @@ discard """
|
||||
44 3
|
||||
more body code
|
||||
yes
|
||||
yes'''
|
||||
yes
|
||||
block expression works'''
|
||||
"""
|
||||
|
||||
template x(body): untyped =
|
||||
@@ -50,3 +51,11 @@ let format =
|
||||
else:
|
||||
echo "Texture Format Unknown, assuming RGB" #This echo causes an error
|
||||
TextureInternalFormat.RGB
|
||||
|
||||
# Block as expressions #3827
|
||||
block:
|
||||
let x = block:
|
||||
var y = 2
|
||||
echo "block expression works"
|
||||
y*y
|
||||
doAssert x == 4
|
||||
Reference in New Issue
Block a user