-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.txt
127 lines (95 loc) · 1.92 KB
/
test.txt
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
fun println() { apply(print, __arguments__); print("\n"); __arguments__; }
fun f() { 42 } f()
if (1) 2
if (0) 2
if (1) 2 else 3
if (0) 2 else 3
var a = 0
while (a < 10) println(a= a + 1)
println(111)
println(222)
println(101) || println(202) || println(303)
println(404) && println(505) && println(606)
0b100
0100
100
0x100
0b1110 | 0b0111;
0b1110 ^ 0b0111;
0b1110 & 0b0111;
!42;
!!42;
-42;
~42;
!0;
-0;
~0;
fun doit(a, b) { println(a < b, a <= b, a == b, a != b, a >= b, a > b) }
doit(0, 0)
doit(0, 1)
doit(0, 2)
doit(1, 0)
doit(1, 1)
doit(1, 2)
doit(2, 0)
doit(2, 1)
doit(2, 2)
1 << 10
65536 >> 8
fun f(n) { if (n < 2) 1 else 1 + f(n-1) + f(n-2) }
// comment
f(15)
fun f() {
var i = 0;
while (i < 10) println(i = i + 1);
}
/* multi
line
comment */
t = millis();
var i = 0;
while (i < 10000) i = i + 1;
println(millis() - t);
do println(i); while ((i = i + 1) < 10);
i= 5;
do println(i); while ((i = i + 1) < 10);
x=null;
for (var x= 100; x < 105; x= x + 1) println(x);
println(x);
for (i= 200; i < 205; i= i + 1) println(i);
println(i);
switch (3) {
case 0: println("zero");
case 1: println("one");
case 2: println("two");
case 3: println("three");
case 4: println("four");
case 5: println("five");
}
switch (#three) {
case #zero: println(0);
case #one: println(1);
case #two: println(2);
case #three: println(3);
case #four: println(4);
case #five: println(5);
}
switch (#nine) {
case #zero: println(0);
case #one: println(1);
case #two: println(2);
case #three: println(3);
case #four: println(4);
case #five: println(5);
}
switch (#nine) {
case #zero: println(0);
case #one: println(1);
case #two: println(2);
case #three: println(3);
case #four: println(4);
default: println(666);
case #five: println(5);
}
println("newline\nanother\012another\x0aanother\u000a")
println("\nmoriturus te saluto\n") && exit(0)