diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/conditionals.bad | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/conditionals.bad b/tests/conditionals.bad new file mode 100644 index 0000000..45e1bd2 --- /dev/null +++ b/tests/conditionals.bad | |||
@@ -0,0 +1,19 @@ | |||
1 | ; Basic if expressions. | ||
2 | if true "hello" | ||
3 | |||
4 | ; These can produce values and the result bound to a name. | ||
5 | let a = if (2 + 2 >= 4) 42 | ||
6 | |||
7 | ; We support a single if expression. | ||
8 | let b = if 0xff == 255 "hello" else "world" | ||
9 | |||
10 | ; ... but these can compound on each other | ||
11 | if 1 < 2 6 | ||
12 | else if 1 > 2 7 | ||
13 | else 8 | ||
14 | |||
15 | ; A block is an expression, and if raise the scope level regardless if a block | ||
16 | ; is used or not. | ||
17 | if true != false { | ||
18 | let a = "yo" | ||
19 | } | ||