about summary refs log tree commit diff stats
path: root/js/baba-yaga/scratch/baba/test_then_alignment.baba
blob: 42b3072c99dca5cec6abf02d16f2c450b6d24342 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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";