From 18365e02b14686e9ad26d1fbc5ac19984b73da6b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 20 Sep 2017 04:43:50 -0700 Subject: Recompiled. --- examples/tutorial.nom | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/tutorial.nom b/examples/tutorial.nom index 776f900..55e558b 100644 --- a/examples/tutorial.nom +++ b/examples/tutorial.nom @@ -52,12 +52,27 @@ if (1 > 10): ..else: say "this will print" -if (1 > 3): - say "this won't print" -..else: if (1 < 2): - say "this won't print" -..else: - say "this will print" +# For longer conditionals, a "when" branch is the best option +when: + ? 1 > 4: + say "this won't print" + ? 1 > 3: + say "this won't print" + ? 1 > 2: + say "this won't print" + ?: + say "this will print" + +# When "when" is given an argument, it works like a switch statement +when 3: + == 1: + say "this won't print" + == 2: + say "this won't print" + == 3: + say "this will print" + ==: + say "this won't print" # Loops look like this: for %x in [1,2,3]: -- cgit v1.2.3