>Where am I going wrong? > >st='x' >#st=gets >if st=='x' > puts 'it's x' >else > puts 'not x' >end > >as written it prints "it's x" as expected but if I take away the # and >execute the st=gets line it's never x. > As the other poster said, you could try strip or chop (or chomp), or you could use strip! or chomp!. Or you could say: if st=="x\n" Or you could use a regular expression in your test: if st =~ /x/ # contains x if st =~ /^x/ # starts with x if st =~ /^x$/ # just x but handles newline ok Kevin