q/examples/factorial/factorial.q
2025-04-07 15:13:57 +02:00

13 lines
135 B
Plaintext

import fmt
main() {
fmt.decimal(factorial(5))
}
factorial(x int) -> int {
if x <= 1 {
return 1
}
return x * factorial(x - 1)
}