Anonymous user
Guess the number/With feedback: Difference between revisions
→{{header|Kotlin}}: Cleanup: Use Kotlin random; Use null chaining instead of null assertion
Not a robot (talk | contribs) (Add FOCAL) |
(→{{header|Kotlin}}: Cleanup: Use Kotlin random; Use null chaining instead of null assertion) |
||
Line 1,875:
=={{header|Kotlin}}==
<lang
fun main(
val n = 1 + rand.nextInt(20)
println("Guess which number I've chosen in the range 1 to 20\n")
while (true) {
print(" Your guess : ")
val guess = readLine()
when (guess) {
n -> { println("Correct, well guessed!") ; return }
|