Guess the number/With feedback: Difference between revisions

→‎{{header|Kotlin}}: Cleanup: Use Kotlin random; Use null chaining instead of null assertion
(Add FOCAL)
(→‎{{header|Kotlin}}: Cleanup: Use Kotlin random; Use null chaining instead of null assertion)
Line 1,875:
 
=={{header|Kotlin}}==
<lang scalakotlin>//import version 1kotlin.1random.2Random
 
fun main(args: Array<String>) {
val rand = java.util.Random()
val n = 1 + rand.nextInt(20)
var guess :Int
println("Guess which number I've chosen in the range 1 to 20\n")
while (true) {
print(" Your guess : ")
val guess = readLine()!!?.toInt()
when (guess) {
n -> { println("Correct, well guessed!") ; return }