J
John Kriple
I'm trying to figure out how to get a user to be able to submit guesses
in a guessing game multiple times.
This is what I have so far:
print "I am thinking of a number between 1 and 10 , can you guess what
it
is? "
num = gets
num = num.chomp
num = num.to_i
if num == 4
puts "You got it!"
elsif num < 4 then
puts "Guess Again"
elsif num > 5 then
puts "Guess Again"
How do I make it so they can keep guessing until they get it right?
Thanks
in a guessing game multiple times.
This is what I have so far:
print "I am thinking of a number between 1 and 10 , can you guess what
it
is? "
num = gets
num = num.chomp
num = num.to_i
if num == 4
puts "You got it!"
elsif num < 4 then
puts "Guess Again"
elsif num > 5 then
puts "Guess Again"
How do I make it so they can keep guessing until they get it right?
Thanks