Skip to content

Instantly share code, notes, and snippets.

@jmoon90
Last active December 20, 2015 03:59
Show Gist options
  • Select an option

  • Save jmoon90/6067944 to your computer and use it in GitHub Desktop.

Select an option

Save jmoon90/6067944 to your computer and use it in GitHub Desktop.
Lottery Game
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
@jmoon90
Copy link
Copy Markdown
Author

jmoon90 commented Jul 24, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment