-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaaronlo.fun
More file actions
49 lines (43 loc) · 719 Bytes
/
aaronlo.fun
File metadata and controls
49 lines (43 loc) · 719 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
#this tests the stack frame of the function, ensuring no variable overwritten on conditional
fun function(x) {
if(x == 0) {
y = 1
}
z = 2
print(x)
if(x == 0) {
print(y)
}
print(z)
a = 3
b = 4
if(x == 0) {
y = 5
print(y)
}
print(z)
print(a)
print(b)
return a
}
fun main() {
#insure that function stack frame resets properly
p = 8
x = function(1)
#should print 1 2 2 3 4
a = 9
#should print 0 1 2 5 2 3 4
y = function(0)
b = 10
#should print 1 2 3 4
z = function(1)
c = 11
#should print 8 3 9 3 10 3 11
print(p)
print(x)
print(a)
print(y)
print(b)
print(z)
print(c)
}