Skip to content

Instantly share code, notes, and snippets.

Created May 7, 2015 11:10
Show Gist options
  • Save anonymous/c35f1b8a7e500be94075 to your computer and use it in GitHub Desktop.
Save anonymous/c35f1b8a7e500be94075 to your computer and use it in GitHub Desktop.
def alphabetize(arr, rev=false)
output = arr.sort
if rev
output.reverse!
end
return output
end
numbers = [5, 6, 8, 15, 66, 4]
puts alphabetize(numbers, true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment