Sort_by


#1

<Below this line, add a link to the EXACT exercise that you are stuck at.>

Step5

Query: When to use ‘sort’ and when to use ‘sort_by’ ? Both methods seem to take a block to define how to compare elements if necessary.




#2

Found with google-search using
ruby sort vs sort_by site:stackoverflow.com
https://stackoverflow.com/questions/17180284/subtle-difference-between-sort-and-sort-by


#3

Seems to be partly a question of efficiency, and if a process is included in the comparison, use sort_by.


#4

More importantly that you can NOT use 2 parameters in the sort_by
read the article mentioned in
Sort_by


#5

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