Equality: equal if they contain the same number of elements and if each element is equal to the corresponding element in the other array. : Compare Array « Array « Ruby






Equality: equal if they contain the same number of elements and if each element is equal to the corresponding element in the other array.


puts [ "a", "c" ] == [ "a", "c", 7 ]  
puts [ "a", "c", 7 ] == [ "a", "c", 7 ]  
puts [ "a", "c", 7 ] == [ "a", "d", "f" ]  

 








Related examples in the same category

1.Comparing Arrays
2.eql? returns true if the objects are the same or if their content is the same.
3.compare arrays is with <=> (spaceship operator).
4.Comparison: Returns an integer -1,0, or +1, if this array is less than, equal to, or greater than other_array.