diff options
| author | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-20 04:43:50 -0700 |
|---|---|---|
| committer | Bruce Hill <bitbucket@bruce-hill.com> | 2017-09-20 04:43:50 -0700 |
| commit | 18365e02b14686e9ad26d1fbc5ac19984b73da6b (patch) | |
| tree | 541932538d66f0505e671d658b4017a3fc67b274 /examples/tutorial.nom | |
| parent | c77ee8f8f9d661c7e7a5753928949c1eb83823c6 (diff) | |
Recompiled.
Diffstat (limited to 'examples/tutorial.nom')
| -rw-r--r-- | examples/tutorial.nom | 27 |
1 files changed, 21 insertions, 6 deletions
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]: |
