Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use v6;
- my $randomNumber = round(100.rand());
- my $attempts = 0;
- while 1 {
- my $userNumber = prompt('Choose a number between 0 and 100 : ');
- if ($userNumber < $randomNumber) {
- say "It's + !";
- $attemps += 1;
- say "Attempts : $attempts";
- }
- elsif ($userNumber > $randomNumber) {
- say "It's - !";
- $attemps += 1;
- say "Attempts : $attempts";
- }
- else {
- say 'Win !';
- $attemps += 1;
- say "Attempts : $attempts";
- last;
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement