Search⌘ K

Exercise 1: Check the Array Equality

Explore how to verify the equality of two arrays in Ruby by using built-in array methods. Learn to generate and select appropriate methods to solve equality problems, enhancing your understanding of Ruby arrays and method application.

We'll cover the following...

Problem statement

Write a Ruby method to check whether two arrays are equal. To do this, you are first required to perform the following two tasks:

  • Task 1: Use the following widget to generate the list of methods supported for an array, in sorted order.
Ruby
# Start your code here
  • Task 2: Select an appropriate method in the generated list that can be used to solve the given problem in the widget under “Try it yourself.”

Example

The following is an example of the problem statement above.

input = [15, 16, 17]
input1 = [15, 16, 17]
result = true

Try it yourself

Ruby
def equal_arrays(input, input1)
# Start your code here
return result
end