Created
December 6, 2013 23:44
-
-
Save damianesteban/7834093 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
# Week One Exercise 2 | |
# Read the sprintf documentation and the % documentation in the | |
# String class and figure out the output being printed by of this Ruby code. | |
puts "%05d" % 123 | |
# The output is 00123 | |
# Similar to Python, % can be used as a formatter. | |
# I looked up the usage of 'd' as an argument formatter in the | |
# ruby docs, 'd' converts the argument as a decimal number. | |
# There was no decimal point in our code, so Ruby "tacks on" two zeros | |
# proceeding 123 (I think) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment