Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ruby programming...
#1
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.

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.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Computer Programming tree_frog 3 482 09-21-2008, 08:43 PM
Last Post: Juke
  Learn Programming Juke 6 282 08-02-2007, 04:21 PM
Last Post: The Mob
  Anyone here do C++ programming? Seekndestroyer 9 309 10-01-2006, 06:06 AM
Last Post: canuc
  2 1/2d programming Kingsrookie 0 175 04-08-2006, 03:08 AM
Last Post: Kingsrookie
  Car Programming Kingsrookie 5 200 02-04-2006, 05:28 AM
Last Post: Osirus
  Programming FAQ skidude 6 594 10-17-2005, 04:13 AM
Last Post: Totte_91boy
  Programming A|fzZz 25 1,377 12-08-2004, 10:06 AM
Last Post: 4sylum

Forum Jump:


Users browsing this thread: 1 Guest(s)