05-29-2005, 05:33 PM
Can anyone who knows the super simple language of ruby, or even anything like it, please help me out.
I'm trying to make a simple thing where, if the program gets 7, then it says "Ok I'll leave you alone now.", and if it gets anything else than it tells them to try again and lets them type in another number.
Here's what I have.
Ok... the problem I'm having is that no matter WHAT you type, it will say "Nope, try again." Somone please help. Thank you.
By the way, this is my second day trying Ruby.
I'm trying to make a simple thing where, if the program gets 7, then it says "Ok I'll leave you alone now.", and if it gets anything else than it tells them to try again and lets them type in another number.
Here's what I have.
Code:
puts 'That\'s a lot of numbers! Can you guess my number, 0-10?'
rep = gets.chomp
while rep != 7
puts 'Nope, try again.'
rep = gets.chomp
if rep == 7
puts 'You got it! I suppose I could leave you alone now. Good-bye ' + var2.capitalize + ' ' + var3.capitalize + '.'
end
end
Ok... the problem I'm having is that no matter WHAT you type, it will say "Nope, try again." Somone please help. Thank you.
By the way, this is my second day trying Ruby.