Error in red but passing the exercise in green (#4 Sorting)


#1




In Ordering your Library exercise 4.Sorting . giving this error in red--> wrong number of arguments (0 for 1)
but it is passing the exercise in green


def alphabetize(arr, rev=false)
    alphabetize.sort!
end
numbers = [5, 1, 3, 8]
puts alphabetize( numbers)


#2

Jajja I just realized I was sorting the method and not the paramater arr wich is the "receiver " of numbers
so the code should be

def alphabetize(arr, rev=false)
arr.sort!
end
numbers = [5, 1, 3, 8]
puts alphabetize( numbers)


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.