From: Chris Dow Date: 2009-10-21T15:40:46+09:00 Subject: 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/.