Last active
April 6, 2016 18:33
-
-
Save Kallin/8f1df7a4657b973eeac10733878477ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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