var correct = false; while !correct { val value = randomInt(10); val guess = readLine("Guess a number 0-9: "); if value == int.parse(guess) { println("You were right!"); correct = true; } else { println("Nope, try again..."); } }