aboutsummaryrefslogtreecommitdiff
path: root/test/when.tm
blob: 28573d880a47f6e08eeb885dbf561c5247da69c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Tests for the 'when' block

func main()
    answers := [
        (
            when x is "A","B"
                "A or B"
            is "C"
                "C"
            else
                "Other"
        ) for x in ["A", "B", "C", "D"]
    ]
    >> answers
    = ["A or B", "A or B", "C", "Other"]

    n := 23
    >> when n is 1 Int64(1)
    is 2 Int64(2)
    is 21 + 2 Int64(23)
    = Int64(23)?