Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH CHRIS PINE\'S TUTORIOUL

Status
Not open for further replies.

linkinprkfan13

Programmer
Aug 16, 2005
2
US
I was doing the exersize in chris pine's tutoriouls for chapter 6 and he asks to do a granny senario, i wrote this code but i cant figure out why it wont work.

puts 'Well hello, sonny!!!'
say = gets.chomp
while say != 'say.upcase'
puts 'HUH?!? WHAT DID YOU SAY SONNY?!?!'
if say == say.upcase
puts 'NOT SINCE 1934!!'
if say == 'BYE'
puts 'CYA!'
 
Code:
puts 'Well hello, sonny!!!'
while true
  say = gets.chomp
  while say != say.upcase
    puts 'HUH?!? WHAT DID YOU SAY SONNY?!?!'    
    say = gets.chomp
  end
  if say == say.upcase
    puts 'NOT SINCE 1934!!'
  end
  if say == 'BYE'
    puts 'CYA!'
    break
  end
end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top