mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-05 04:27:44 +00:00
35 lines
464 B
Nim
35 lines
464 B
Nim
discard """
|
|
output: '''0
|
|
|12|
|
|
34
|
|
'''
|
|
"""
|
|
|
|
template optWrite{
|
|
write(f, x)
|
|
((write|writeLine){w})(f, y)
|
|
}(x, y: varargs[untyped], f, w: untyped) =
|
|
w(f, "|", x, y, "|")
|
|
|
|
if true:
|
|
echo "0"
|
|
write stdout, "1"
|
|
writeLine stdout, "2"
|
|
write stdout, "3"
|
|
echo "4"
|
|
|
|
# bug #7972
|
|
|
|
template optimizeLogWrites*{
|
|
write(f, x)
|
|
write(f, y)
|
|
}(x, y: string{lit}, f: File) =
|
|
write(f, x & y)
|
|
|
|
proc foo() =
|
|
const N = 1
|
|
stdout.write("")
|
|
stdout.write("")
|
|
|
|
foo()
|