On Mon, Dec 3, 2012 at 12:35 PM, Masoud Ahmadi <[email protected]> wrote:
> This row solved my problem,
>  if op == "Q\n"
> I was not aware of this little new line thing

Just a note on that one: I think this solution is inferior to doing

op.chomp!
if op == "Q"

or

if op.chomp == "Q"

Reason: on other platforms you might get a different terminating
character than \n.  Also the terminator is usually not considered part
of the input.  You could even go a step further and get rid of
whitespace thus allowing for more valid inputs:

op = gets.strip

Kind regards

robert

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

-- You received this message because you are subscribed to the Google Groups 
ruby-talk-google group. To post to this group, send email to 
[email protected]. To unsubscribe from this group, send email 
to [email protected]. For more options, visit this 
group at https://groups.google.com/d/forum/ruby-talk-google?hl=en

Reply via email to