From 6a38600ce88bbf2d9fa9a3821d7df3ebd8e0d4f3 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 30 Aug 2021 19:15:05 +0300 Subject: chore(tazjin/rlox): Add some old code example files Change-Id: I484b11069286ea2277e9e158fa5c3bd34f84c89e Reviewed-on: https://cl.tvl.fyi/c/depot/+/3464 Tested-by: BuildkiteCI Reviewed-by: tazjin --- users/tazjin/rlox/examples/hello.lox | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 users/tazjin/rlox/examples/hello.lox (limited to 'users/tazjin/rlox/examples/hello.lox') diff --git a/users/tazjin/rlox/examples/hello.lox b/users/tazjin/rlox/examples/hello.lox new file mode 100644 index 000000000000..31752d9e2f5e --- /dev/null +++ b/users/tazjin/rlox/examples/hello.lox @@ -0,0 +1,34 @@ +var a = 12; +var b = a * 2; + +{ + var b = a * 3; + a = 42; + print b; +} + +print a; +print b; + +if (5 > 4) + print "it's true"; +else + print "it's false"; + +if (false) + print "it's not true"; + +if (true and false) + print "won't happen"; + +if (true or false) + print "will happen"; + +var n = 5; +while (n > 0) { + print "counting down"; + n = n - 1; +} + +for(var i = 0; i < 10; i = i + 1) + print "bla"; -- cgit 1.4.1