Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Array#eql?

(untyped other) -> bool
eql?(other_array) → true or false

Returns true if self and other_array are the same size, and if, for each index i in self, self[i].eql?(other_array[i]):

Example
a0 = [:foo, 'bar', 2]
a1 = [:foo, 'bar', 2]
a1.eql?(a0) # => true

Otherwise, returns false.

This method is different from method Array#==, which compares using method Object#==.

Related: see Methods for Querying.

See also #empty? #fetch #each_index #fetch_values also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0