SHOW:
|
|
- or go back to the newest paste.
1 | # random game | |
2 | ||
3 | x = rand(100) | |
4 | guess = -1 | |
5 | while guess != x | |
6 | puts('Please enter a number between 0 and 99') | |
7 | guess = gets.to_i | |
8 | puts(guess.to_s + ' is too high!') if guess > x | |
9 | puts(guess.to_s + ' is too low!') if guess < x | |
10 | end | |
11 | ||
12 | puts(x.to_s + ' is the right number!') | |
13 | ||
14 | ||
15 |