about summary refs log tree commit diff
path: root/users/tazjin/rlox/examples/scope.lox
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-08-30T16·15+0300
committertazjin <mail@tazj.in>2021-10-19T12·58+0000
commit6a38600ce88bbf2d9fa9a3821d7df3ebd8e0d4f3 (patch)
treea0e80c4430f8e470d405c4b193c5a71e6ce5a64f /users/tazjin/rlox/examples/scope.lox
parentedd8680e8773e4568d3d645c53932cf75ebf09fa (diff)
chore(tazjin/rlox): Add some old code example files r/2976
Change-Id: I484b11069286ea2277e9e158fa5c3bd34f84c89e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3464
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/tazjin/rlox/examples/scope.lox')
-rw-r--r--users/tazjin/rlox/examples/scope.lox19
1 files changed, 19 insertions, 0 deletions
diff --git a/users/tazjin/rlox/examples/scope.lox b/users/tazjin/rlox/examples/scope.lox
new file mode 100644
index 000000000000..d563807943ba
--- /dev/null
+++ b/users/tazjin/rlox/examples/scope.lox
@@ -0,0 +1,19 @@
+var a = "global a";
+var b = "global b";
+var c = "global c";
+{
+  var a = "outer a";
+  var b = "outer b";
+  {
+    var a = "inner a";
+    print a;
+    print b;
+    print c;
+  }
+  print a;
+  print b;
+  print c;
+}
+print a;
+print b;
+print c;