aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2024-06-18 16:57:24 +0200
committerBad Diode <bd@badd10de.dev>2024-06-18 16:57:24 +0200
commitc80020d23599a9ea7b60f83449dbb93762ca9770 (patch)
tree259d721f962783e4a51691b1034708f3e305eb20 /tests
parent649b378bb01a6964b9deec4d0fe57aeae1e5cb9e (diff)
downloadbdl-c80020d23599a9ea7b60f83449dbb93762ca9770.tar.gz
bdl-c80020d23599a9ea7b60f83449dbb93762ca9770.zip
Add parsing support for basic conditionals and blocks
Diffstat (limited to 'tests')
-rw-r--r--tests/conditionals.bad19
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.
2if true "hello"
3
4; These can produce values and the result bound to a name.
5let a = if (2 + 2 >= 4) 42
6
7; We support a single if expression.
8let b = if 0xff == 255 "hello" else "world"
9
10; ... but these can compound on each other
11if 1 < 2 6
12else if 1 > 2 7
13else 8
14
15; A block is an expression, and if raise the scope level regardless if a block
16; is used or not.
17if true != false {
18 let a = "yo"
19}