RosettaCodeData/Task/Repeat/Kotlin/repeat.kotlin
2023-07-01 13:44:08 -04:00

12 lines
186 B
Text

// version 1.0.6
fun repeat(n: Int, f: () -> Unit) {
for (i in 1..n) {
f()
println(i)
}
}
fun main(args: Array<String>) {
repeat(5) { print("Example ") }
}