about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/then_alignment_demo.baba
blob: 4a4ce35332302b30f0c41b14d97c56a5e49eda73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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";