schala/recurse.maaru

25 lines
220 B
Plaintext
Raw Normal View History

2017-01-02 23:39:18 -08:00
fn hella(x) {
2017-01-02 23:39:18 -08:00
print("hey")
if x == 3 {
2017-01-02 23:39:18 -08:00
Null
} else {
2017-01-02 23:39:18 -08:00
hella(x + 1)
}
}
2017-01-02 23:39:18 -08:00
hella(0)
fn fib(x) {
if x < 3 {
1
} else {
fib(x - 1) + fib(x - 2)
}
}
2017-01-02 23:39:18 -08:00
fib(10)