Make repeat example more expressive

This commit adds the zero-based index of current iteration from the passed HOF "action" of the repeat function to its associated code sample.

KT-20357
This commit is contained in:
Julian Kotrba
2020-08-03 23:48:06 +02:00
committed by GitHub
parent a5178bb826
commit 88f508446a
@@ -15,9 +15,14 @@ class ControlFlow {
repeat(3) {
println("Hello")
}
// greets with an index
repeat(3) { index ->
println("Hello with index $index")
}
repeat(0) {
error("We should not get here!")
}
}
}
}