-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfor.sb
84 lines (72 loc) · 1.08 KB
/
for.sb
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import assert
as = assert.Assert
a = 1
i = 0
for a {
as(1, a)
i += 1
if i > 3 {
a = 0
}
}
as(0, a)
l = ["a", "b", "c", "d", "e"]
idx = 0
for i, e in l {
if idx == 0 {
as(0, i)
as("a", e)
} elif idx == 1 {
as(1, i)
as("b", e)
} elif idx == 2 {
as(2, i)
as("c", e)
} elif idx == 3 {
as(3, i)
as("d", e)
} elif idx == 4 {
as(4, i)
as("e", e)
} else {
print("must not come here")
exit(1)
}
idx += 1
}
as(5, idx)
for i, e in [] {
print("must not come here")
exit(1)
}
idx = 0
for i, e in "abc" {
if idx == 0 {
as(0, i)
as("a", e)
} elif idx == 1 {
as(1, i)
as("b", e)
} elif idx == 2 {
as(2, i)
as("c", e)
} else {
print("must not come here")
exit(1)
}
idx += 1
}
a = 0
for i, e in l {
a = e
if i == 2 {
break
}
}
as("c", a)
for i, e in l {
continue
print("must not come here")
exit(1)
}
print("for test succeeded")