Re: Deaf Grandma
- From: Chris Dow <chrisdow32@xxxxxxxxxxx>
- Date: Wed, 21 Oct 2009 01:40:46 -0500
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/.
.
- References:
- Re: Deaf Grandma
- From: Chris Mr.
- Re: Deaf Grandma
- From: Michael W. Ryder
- Re: Deaf Grandma
- From: Michael W. Ryder
- Re: Deaf Grandma
- Prev by Date: Re: Mutex confusion
- Next by Date: Re: Certificate hashes using Base64, DER, ASN.1, PkiPath...
- Previous by thread: Re: Deaf Grandma
- Next by thread: Loading program that uses gems on network share is incredibly slow
- Index(es):
Relevant Pages
|