about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/then_alignment_demo.baba
diff options
context:
space:
mode:
Diffstat (limited to 'js/baba-yaga/scratch/baba/then_alignment_demo.baba')
-rw-r--r--js/baba-yaga/scratch/baba/then_alignment_demo.baba27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/baba-yaga/scratch/baba/then_alignment_demo.baba b/js/baba-yaga/scratch/baba/then_alignment_demo.baba
new file mode 100644
index 0000000..4a4ce35
--- /dev/null
+++ b/js/baba-yaga/scratch/baba/then_alignment_demo.baba
@@ -0,0 +1,27 @@
+processRequest : method path -> 
+when method path is
+  "GET" "/"                    then "Home page"
+  "GET" "/about"               then "About page"
+  "POST" "/api/users"          then "Create user"
+  "DELETE" "/api/users"        then "Delete user"
+  "PATCH" "/api/users/profile" then "Update profile"
+  _ _                          then "Not found";
+
+analyzeData : type value -> 
+when type is
+  "number" then 
+    when value > 0 is
+      true then 
+        when value > 1000 is
+          true     then "large positive"
+          false    then "small positive"
+          false    then "negative or zero"
+          "string" then 
+            when length value > 10 is
+              true      then "long string"
+              false     then "short string"
+              "boolean" then 
+                when value is
+                  true  then "truthy"
+                  false then "falsy"
+                  _     then "unknown type";