blob: 8bb1a5d94014484accc4524371b755976b52caf7 (
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
28
29
30
31
32
33
34
35
36
37
38
|
fn main() {
auto x = vec(1,2,3);
auto y = 0;
for (int i in x) {
log i;
y += i;
}
log y;
check (y == 6);
auto s = "hello there";
let int i = 0;
for (u8 c in s) {
if (i == 0) {
check (c == ('h' as u8));
}
if (i == 1) {
check (c == ('e' as u8));
}
if (i == 2) {
check (c == ('l' as u8));
}
if (i == 3) {
check (c == ('l' as u8));
}
if (i == 4) {
check (c == ('o' as u8));
}
// ...
if (i == 12) {
check (c == (0 as u8));
}
i += 1;
log i;
log c;
}
check(i == 12);
}
|