mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-26 17:24:02 +00:00
language addition: colon-block for expressions in let/var context
This commit is contained in:
33
tests/parser/tletcolon.nim
Normal file
33
tests/parser/tletcolon.nim
Normal file
@@ -0,0 +1,33 @@
|
||||
discard """
|
||||
output: '''boo
|
||||
3
|
||||
44 3
|
||||
more body code
|
||||
yes
|
||||
yes'''
|
||||
"""
|
||||
|
||||
template x(body): untyped =
|
||||
body
|
||||
44
|
||||
|
||||
template y(val, body): untyped =
|
||||
body
|
||||
val
|
||||
|
||||
proc mana =
|
||||
let foo = x:
|
||||
echo "boo"
|
||||
var foo2 = y 3:
|
||||
echo "3"
|
||||
echo foo, " ", foo2
|
||||
|
||||
mana()
|
||||
let other = x:
|
||||
echo "more body code"
|
||||
if true:
|
||||
echo "yes"
|
||||
else:
|
||||
echo "no"
|
||||
let outer = y(5):
|
||||
echo "yes"
|
||||
Reference in New Issue
Block a user