Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Number guessing game in Raku
put 'Guess the number!';
my Int:D $secret_number := (1..100).pick;
loop {
with +prompt "Please input your guess.\n" {
when UInt:D {
put "You guessed: $_";
given $_ <=> $secret_number {
when More { put 'Too big!' }
when Less { put 'Too small!' }
when Same { put 'You win!'; last }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment