about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/test_then_alignment.baba
diff options
context:
space:
mode:
Diffstat (limited to 'js/baba-yaga/scratch/baba/test_then_alignment.baba')
-rw-r--r--js/baba-yaga/scratch/baba/test_then_alignment.baba18
1 files changed, 18 insertions, 0 deletions
diff --git a/js/baba-yaga/scratch/baba/test_then_alignment.baba b/js/baba-yaga/scratch/baba/test_then_alignment.baba
new file mode 100644
index 0000000..42b3072
--- /dev/null
+++ b/js/baba-yaga/scratch/baba/test_then_alignment.baba
@@ -0,0 +1,18 @@
+// Test then alignment
+checkNumber : num ->
+  when num is
+    1 then "One"
+    2 then "Two" 
+    10 then "Ten"
+    100 then "One Hundred"
+    _ then "Something else";
+
+// Test with nested when
+classify : n ->
+  when n is
+    0 then "zero"
+    _ then when n > 100 is
+            true then "large"
+            _    then when n > 10 is
+                        true then "medium"
+                        _    then "small";