Re: Deaf Grandma



Michael W. Ryder wrote:
Michael W. Ryder wrote:
puts "Hey Sonny! It's your lovely Grandmother! How are you?"
puts "NO! NOT SINCE " + (1930+rand(21)).to_s + "!"
I'm a noob, but this seems cleaner to me. I know there is a way to


This only uses one entry of response and no flags.

I missed the part about removing the multiple if's in the oringal post.

#Grandma is deaf!

puts "Hey Sonny! It's your lovely Grandmother! How are you?"

while (response = gets.chomp) != "BYE"
if response != response.upcase
puts "Huh?! I CAN'T HEAR YOU!"
else
puts "NO! NOT SINCE " + (1930+rand(21)).to_s + "!"
end
end
puts "GOOD BYE, SONNY!"

That one is sweet. Thanks. I guess I was over thinking it, LOL. I didn't
think of putting the first response in parentheses. This helped me think
of it in a much easier way.
--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • How to fetch Cookie from response
    ... by passing user & password. ... I'm having problem with fetching cookies from the response & ... puts "1st Code = #" ...
    (comp.lang.ruby)
  • Re: Deaf Grandma
    ... puts "Hey Sonny! ... It's your lovely Grandmother! ... if response!= response.upcase ...
    (comp.lang.ruby)
  • Re: Deaf Grandma
    ... puts "Hey Sonny! ... It's your lovely Grandmother! ... response = nil ... response = gets.chomp ...
    (comp.lang.ruby)
  • Re: Deaf Grandma
    ... puts "Hey Sonny! ... It's your lovely Grandmother! ... if response!= response.upcase ...
    (comp.lang.ruby)
  • Re: ruby / rexml / xpath bug?
    ... I copied a Google Maps script from Google Maps with Rails and Ajax ... puts "Unable to parse Google response for #" ... end # end each store ...
    (comp.lang.ruby)