Loops/Break: Difference between revisions
→{{header|Kotlin}}
Line 2,129:
println(Random.nextInt(20))
}
}</syntaxhighlight>
A more compact version:
<syntaxhighlight lang="kotlin">import kotlin.random.Random
fun main() {
while (Random.nextInt(20).also { println(it) } != 10)
println(Random.nextInt(20))
}</syntaxhighlight>
|