Sort an integer array
var nums = [2,4,3,1,2]
var sorted = nums.sort   # returns a new sorted array.
nums.sort!               # sort 'nums' in-place (at the variable level)Last updated
Was this helpful?
var nums = [2,4,3,1,2]
var sorted = nums.sort   # returns a new sorted array.
nums.sort!               # sort 'nums' in-place (at the variable level)Last updated
Was this helpful?