summary refs log tree commit diff stats
path: root/examples/talk/lazyeval.nim
diff options
context:
space:
mode:
Diffstat (limited to 'examples/talk/lazyeval.nim')
-rw-r--r--examples/talk/lazyeval.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/talk/lazyeval.nim b/examples/talk/lazyeval.nim
new file mode 100644
index 000000000..77d963834
--- /dev/null
+++ b/examples/talk/lazyeval.nim
@@ -0,0 +1,12 @@
+
+const
+  debug = true
+
+template log(msg: string) =
+  if debug:
+    echo msg
+var
+  x = 1
+  y = 2
+
+log("x: " & $x & ", y: " & $y)