zaagan
12/11/2019 - 8:48 PM

Ruby Basics - Comparison Operators

Ruby Basics - Comparison Operators

=begin  Equality and Relational Operator

== 	Equal; see discussion below

!= 	Not equal

> 	Greater than

< 	Less than

>= 	Greater than or equal to

<= 	Less than or equal to

<=> Combined comparison operator.
    0 if first operand equals second,
    1 if first operand is greater than the second
    -1 if first operand is less than the second.

=== Test equality within a when clause of a case statement.
    (1...10) === 5 returns true.

.eql? True if the receiver and argument have
      both the same type and equal values.
      1 == 1.0 returns true, but 1.eql?(1.0) is false.

equal? True if the receiver and argument have the same object id.
       if aObj is duplicate of bObj then,
       aObj == bObj is true, 
       a.equal?bObj is false but,
       a.equal?aObj is true.
=end