Notice that we use two equal symbols to mean equality.
Ruby string equality.
For each operator plus.
The text within the quote marks is the value of the string this is a simple ruby string literal.
One equals sign in ruby means assignment make sure to use when you want to find out if two things are the same.
But what if string didn t implement.
If the strings are of different lengths and the strings are equal when compared up to the shortest length then the longer string is considered greater than the shorter one.
For example a plus.
Then ruby would use object s implementation of which defaults to testing for object identity instead of object contents.
If the strings are of different lengths and the strings are equal when compared up to the shortest length then the longer string is considered greater than the shorter one.
A string object in ruby holds and manipulates an arbitrary sequence of one or more bytes typically representing characters that represent human language.
Ruby supports a rich set of operators as you d expect from a modern language.
Object new object new false string new string.
If you don t this right you won t get the expected results.
Comparison returns 1 0 1 or nil depending on whether string is less than equal to or greater than other string.
This works because the string class implements a two equal signs method that knows how to compare strings.
Nil is returned if the two values are incomparable.
Many of ruby s built in classes such as string range and regexp provide their own implementations of the operator also known as case equality triple equals or threequals.
Nil is returned if the two values are incomparable.
There is a corresponding form of abbreviated assignment operator.
Comparison returns 1 0 1 or nil depending on whether string is less than equal to or greater than other string.
Most operators are actually method calls.
B is interpreted as a plus b where the plus.
With an if statement you can check if something is true.
Because it s implemented differently in each class it will behave differently depending on the type of object it was called on.
The simplest string literals are enclosed in single quotes the apostrophe character.
But when you want to check for the opposite not true false.