19. Sorting


#1

Im just curious why this block of code isnt used to simplify a reverse alphabetical/numerical order even tho it correctly does so.

fruits = ["orange", "apple", "banana", "pear", "grapes"]

fruits.sort!.reverse!

Just want to make sure this is also a proper method of doing this even tho it isnt what has been asked in the exercise


#2

I just tried using your code, and it worked (as well as passed that section of the course). So obviously your code is correct and works. Also it's shorter than the code they actually want us to use. I'm just assuming that the main idea of the code they wanted was to teach us to use the do loop to swap/reverse the list.