[DOC] Tweaks for Array#==

This commit is contained in:
BurdetteLamar 2024-08-07 22:15:56 +01:00 committed by Peter Zhu
parent 64a7b87e1d
commit 6fee51069c
Notes: git 2024-08-08 20:06:01 +00:00

20
array.c
View File

@ -5136,17 +5136,21 @@ recursive_equal(VALUE ary1, VALUE ary2, int recur)
/* /*
* call-seq: * call-seq:
* array == other_array -> true or false * self == other_array -> true or false
* *
* Returns +true+ if both <tt>array.size == other_array.size</tt> * Returns whether both:
* and for each index +i+ in +array+, <tt>array[i] == other_array[i]</tt>:
* *
* a0 = [:foo, 'bar', 2] * - +self+ and +other_array+ are the same size.
* a1 = [:foo, 'bar', 2.0] * - Their corresponding elements are the same;
* a1 == a0 # => true * that is, for each index +i+ in <tt>(0...self.size)</tt>,
* [] == [] # => true * <tt>self[i] == other_array[i]</tt>.
* *
* Otherwise, returns +false+. * Examples:
*
* [:foo, 'bar', 2] == [:foo, 'bar', 2] # => true
* [:foo, 'bar', 2] == [:foo, 'bar', 2.0] # => true
* [:foo, 'bar', 2] == [:foo, 'bar'] # => false # Different sizes.
* [:foo, 'bar', 2] == [:foo, 'bar', 3] # => false # Different elements.
* *
* This method is different from method Array#eql?, * This method is different from method Array#eql?,
* which compares elements using <tt>Object#eql?</tt>. * which compares elements using <tt>Object#eql?</tt>.