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 1 year ago