-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.krust
80 lines (69 loc) · 1.07 KB
/
test.krust
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
print "one";
var a = "global a";
var b = "global b";
var c = "global c";
{
var a = "outer a";
var b = "outer b";
{
var a = "inner a";
print a;
print b;
print c;
}
print a;
print b;
print c;
}
print a;
print b;
print c;
var a = 0;
var temp;
for (var b = 1; a < 10000; b = temp + b) {
print a;
temp = a;
a = b;
}
class Cake {
init() {
print "initializing";
this.color = "brown";
return;
print "this is not run";
}
taste() {
var adjective = "delicious";
print "The " + this.color + " " + this.flavor + " cake is " + adjective + "!";
}
}
var cake = Cake();
cake.flavor = "German chocolate";
cake.taste();
class Doughnut {
cook() {
print "Fry until golden brown.";
}
}
class BostonCream < Doughnut {
cook() {
super.cook();
print "Pipe full of custard and coat with chocolate.";
}
}
BostonCream().cook();
class A {
a() {
print "super a";
}
b() {
print "super b";
}
}
class B < A {
a() { super.a(); print "sub a"; }
b() { super.b(); print "sub b"; }
}
var b = B();
b.a();
b.b();