Mega Code Archive

 
Categories / Ruby / Array
 

Eql returns true if the objects are the same or if their content is the same

# eql? checks to see if the values are equal (as in ==), but also checks if the values are of the same type. myArray1 = [ "full", 40, "yes" ] myArray2 = ["part", 23, "no"] myArray3 = [ "full", 40, "yes" ] myArray1 == myArray3 # => true myArray1.eql?( "full, 40, yes" ) # => false, myArray1 is not a string