mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-02 00:29:22 -06:00
8 lines
143 B
Plaintext
8 lines
143 B
Plaintext
public fun factorial(_ n: Int) -> Int {
|
|
if n < 2 { 1 } else { n * factorial(n - 1) }
|
|
}
|
|
|
|
public fun main() -> Int32 {
|
|
Int32(factorial(5))
|
|
}
|