Sorting/Alphabetize/Return


#1



https://www.codecademy.com/en/courses/ruby-beginner-en-nOho7/0/4?curriculum_id=5059f8619189a5000201fbcb


I have two questions:
1. Can someone please explain to me the part in bold? What does it mean? I am struggling to get the logic. (I am completely new to coding in general, I have followed all steps up to this thoroughly to understand the structure, but wondering if everytime something is on the last line, it will always be returned??)
"Inside your method, add a line that calls .sort! on the arr array. Since it is the last line of the method, the sorted array will be returned."

  1. Why do I get this approved, when clearly the numbers are not printed to the console?


Replace this line with your code.


#2

Pay attention to the second set of instructions.
It wants you to create the numbers array AFTER your method.

your alphabetize method should look like this

def alphabetize(arr, rev=false)
arr.sort!
end

Create your numbers array after that, then call your alphabetize method on your numbers array.


#3

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