Implemented else blocks

This commit is contained in:
2024-07-30 16:36:33 +02:00
parent 5abe8acc70
commit 323952f4bc
17 changed files with 118 additions and 25 deletions

View File

@ -1,7 +1,7 @@
import sys
import log
main() {
sys.exit(factorial(5))
log.number(factorial(5))
}
factorial(x) {

View File

@ -1,7 +1,7 @@
import sys
import log
main() {
sys.exit(fibonacci(10))
log.number(fibonacci(10))
}
fibonacci(x) {

19
examples/gcd/gcd.q Normal file
View File

@ -0,0 +1,19 @@
import log
main() {
log.number(gcd(1071, 462))
}
gcd(a, b) {
loop {
if a == b {
return a
}
if a > b {
a -= b
} else {
b -= a
}
}
}