Comparing Strings in Ruby
Ruby strings can be compared using comparison operators (==
, <
, >
, etc.).
"hello" == "hello" # true
"hello" == "goodbye" # false
String comparison in Ruby is case sensitive:
"hi" == "HI" # false
"oRanGE" == "ORanGe" # false
"oRanGE".downcase == "ORanGe".downcase # true