2024-07-30 16:36:33 +02:00
|
|
|
import log
|
2024-07-18 18:08:30 +02:00
|
|
|
|
2024-07-15 16:51:36 +02:00
|
|
|
main() {
|
2024-07-30 16:36:33 +02:00
|
|
|
log.number(factorial(5))
|
2024-07-15 16:51:36 +02:00
|
|
|
}
|
|
|
|
|
2024-08-05 18:47:24 +02:00
|
|
|
factorial(x Int) -> Int {
|
2024-07-15 16:51:36 +02:00
|
|
|
if x <= 1 {
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
return x * factorial(x - 1)
|
|
|
|
}
|