Challenge for Send Parameters for Control

Challenge

The following Ruby code returns half of the maximum number in an array:

def max(ar)
  ar.max / 2
end

This code can now be passed an array and it will return the maximum number in it divided by 2:

 max([1, 3, 20]) #=> 10

The parameter in max is then modified as follows:

def max(*ar)
  ar.max / 2
end

Rewrite the above call to max so it works with the modified method. (Pass in the same numbers in the same order.)

Please sign in or sign up to submit answers.

Alternatively, you can try out Learneroo before signing up.

Contact Us
Sign in or email us at [email protected]