summaryrefslogtreecommitdiff
path: root/test/ctlstmt.lc
blob: 504d3aff46e79c259d391886e2236f1271ac2518 (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

func test() int
{
    if 1 == 2 return 34
    else if 1 == 3 return 45
    else {
        while 1 == 2 {
            if 1 == 2 continue
            else break
        }
    }
    #do { } while 1 == 2
    do break while 1 == 2
    do {
        if 1 == 2 break
    } while 1 == 2 loopend {
        while 1 == 2 break
        loopempty return 345
    }

    if 1 == 2 {
    }

    var [3]int arr
    for int i in arr {
        if 1 == 2 break
    } loopempty {
        return 23
    }

    int i = 123
    var int st
    switch i {
    case 1
    case 2
        return 2
    case 3 with { st = 0 }
    case 4 with { st = 1 }
        return 3
    case 5
    default with { st = 2 }
        return 4
    }

    # test of strange switch blocks
    switch i {
    case 1
    }

    switch i {
    default
    }

    switch i {
    }

  backward:
    if 1==2 goto forward
    if 2==3 {
      forward:
    }
    while 1==2 {
        goto backward
    }

    # not allowed
    #if 1==2 byte b
    #for int x in arr byte b

    return 123
}