Implemented variable scopes
This commit is contained in:
11
examples/factorial/factorial.q
Normal file
11
examples/factorial/factorial.q
Normal file
@ -0,0 +1,11 @@
|
||||
main() {
|
||||
syscall(60, factorial(5))
|
||||
}
|
||||
|
||||
factorial(x) {
|
||||
if x <= 1 {
|
||||
return 1
|
||||
}
|
||||
|
||||
return x * factorial(x - 1)
|
||||
}
|
Reference in New Issue
Block a user