From: Paul McMahon Date: 2008-02-14T16:20:07+09:00 Subject: Re: Problem usning 'OR' operator in 'IF' condition? Apply De Morgan's and you'll see this condition is always true: @character != 'R' || @character != 'r' is equivalent to !(@character == 'R' && @character == 'r') As @character can never be both 'R' and 'r', @character == 'R' && @character == 'r' is always false, so the statement is !(false) which is true. So your code is equivalent to if true raise " Expected 'R' after 'E' in version Declaration" end which is equivalent to raise " Expected 'R' after 'E' in version Declaration" You really mean something like if @character != 'R' && @character != 'r' raise " Expected 'R' after 'E' in version Declaration" end Which is better done if @character !~ /^r$/i raise " Expected 'R' after 'E' in version Declaration" end If you use regular expressions, then you can probably save yourself a lot of unecessary conditionals by writing something like if some_string !~ /^er$/i raise " Expected 'R' after 'E' in version Declaration" end