blob: a129e6ffdbf948b7427ae40f36437dbde06de007 (
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
|
implement Loops;
include "sys.m";
include "draw.m";
sys: Sys;
print: import sys;
Loops: module {
init: fn(nil: ref Draw->Context, nil: list of string);
};
init(nil: ref Draw->Context, nil: list of string) {
sys = load Sys Sys->PATH;
print("== for\n");
for(i := 0; i < 10; i++){
if(i % 2 == 0)
continue;
print("%d\n", i * i);
}
print("== while\n");
n := 7;
while(n)
print("%d\n", n--);
print("== do\n");
do{
print("%d\n", ++n);
break;
}while(1);
exit;
}
|