mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
It is just prototype * does not make top level symbols visible as class members yet * does not take parameters * Script class name is hardcoded now
12 lines
156 B
Plaintext
12 lines
156 B
Plaintext
// expected: 3628800
|
|
|
|
fun factorial(n: Int): Int {
|
|
var product = 1
|
|
for (i in 1..n) {
|
|
product *= i
|
|
}
|
|
return product
|
|
}
|
|
|
|
factorial(10)
|