From: Michal Suchanek Date: 2011-08-31T21:48:33+09:00 Subject: Re: Deaf Grandma Program doesn't work right On 31 August 2011 14:30, Samuel Mensah wrote: > Grandma has hearing issues 'cos she's getting old. All she does is > answer my questions with a phrase "NO NOT SINCE 1938'. If I don't > yell(.upcase), she's gonna tell me to speak up. If I yell without a > question mark, she'll tell me "THAT'S NOT A QUESTION!". I write a > program for this scenario and anytime I yell with or without a question > mark, she tells me "THAT'S NOT A QUESTION!" > > What am I doing wrong or at least what am I missing? > > question = '' > puts 'Ask grandma something...' > while question != 'BYE!' >    question = gets.chomp >   if question != question.upcase >     puts 'HUH?! SPEAK UP, SONNY!' >   elsif question == question.upcase+'?' Try like this: question == question.upcase[0...-1]+'?' >     puts 'NO, NOT SINCE 1938!' >   elsif question == question.upcase >     puts 'THAT\'S NOT A QUESTION!' >   elsif question == 'BYE!' >     puts 'BYE!' >   end > end > > -- > Posted via http://www.ruby-forum.com/. > > HTH Michal