ArgumentError: comparison of Fixnum with String failed : sort « Array « Ruby






ArgumentError: comparison of Fixnum with String failed


[1, 2, 3, "a", "b", "c"].sort

 








Related examples in the same category

1.apply the sort (or sort!, for in-place changes)
2.Get the top 5 elements
3.Get the bottom 5 elements
4.Sort object array by object attribute