-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlox.lox
More file actions
50 lines (39 loc) · 653 Bytes
/
Copy pathlox.lox
File metadata and controls
50 lines (39 loc) · 653 Bytes
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
/*
fun fib(n) {
if (n <= 1) {
return n;
}
return fib(n - 2) + fib(n - 1);
}
for (var i = 0; i < 20; i = i + 1) {
// print fib(i);
}
fun make_counter() {
var i = 0;
fun count() {
i = i + 1;
print i;
}
return count;
}
var counter = make_counter();
counter();
counter();
var a = "Global";
{
// Testing to see if the variable a inside show_a gets mutated
fun show_a() {
print a;
}
show_a();
var a = "Inner";
a = "Inner re-assigned";
show_a(); // This should be "Global"
}
*/
class Foobar {}
{
var inst = Foobar();
inst.a = 3;
print inst.a;
}