-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path031.fun
More file actions
67 lines (57 loc) · 1.17 KB
/
031.fun
File metadata and controls
67 lines (57 loc) · 1.17 KB
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
########### testing # many # hashtags # in # a # comment
# make sure we can name the function 'format'
fun format() {
# make sure if doesn't return if the statement is false
if(0) {
return 2
}
# make sure while terminates upon return
while(1) {
return 1
}
}
# basic if, parameters, return test
fun a(y, z)
# comment to test spacing issues
{
x = 5
y = x
if(z) {
return y + x
}
else
# comment to test spacing issues
{
return x
}
}
# testing that you can call functions declared below
fun b(x) {
if(x <= 3) {
return 3 * x
}
return c(x - 1)
}
fun c(x) {
#testing that functions can call each other
if(x <= 2) {
return 2 * x
}
return b(x - 1)
}
fun main() {
print(format())
print(a(1, 2))
print(a(2, 0))
#testing if variables can be the same name as functions
a = 3
format = 5
#testing basic precedence, operators, etc
print(format - a % (format / 2))
print(format < a >= format - format)
print(a(1, 1) - format % a)
print(a(1, 1) % (2 * format() + format))
#testing that functions can call each other
print(b(5))
print(b(6))
}