Skip to content

Instantly share code, notes, and snippets.

@Kallin
Last active April 6, 2016 18:33
Show Gist options
  • Save Kallin/8f1df7a4657b973eeac10733878477ed to your computer and use it in GitHub Desktop.
Save Kallin/8f1df7a4657b973eeac10733878477ed to your computer and use it in GitHub Desktop.
def num_to_digits(num)
digits = []
until num == 0
digits << num % 10
num = num / 10
end
digits
end
puts num_to_digits 1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment