0
Ruby .sort method
I am doing challenge in ruby What's the output of this code? arr = ["baa", "aba", "aab"] arr.sort print arr [0] ---------- the answer is "baa" But as far as I understand .sort it should be "aab". Please explain if I am wrong.
1 Antwort
+ 1
documentation usually help in this case.
sort is returning a new array, but not altering the array itself.
sort! do