Last active
December 20, 2015 03:59
-
-
Save jmoon90/6067944 to your computer and use it in GitHub Desktop.
Lottery Game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Lottery | |
| def self.rand_number | |
| randoms = [ ] | |
| loop do | |
| puts "Enter a random number" | |
| new_number = gets.chomp | |
| if new_number.to_s == rand(1..10).to_s | |
| puts "You are a winner" | |
| return | |
| else | |
| puts "You lost the chance" | |
| return | |
| end | |
| end | |
| end | |
| end | |
| a = Lottery.rand_number |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will always return you to the normal screen. You will need to type a = Lottery.rand_number every time you wish to play the game.