Created
August 27, 2013 00:55
-
-
Save jendiamond/6348514 to your computer and use it in GitHub Desktop.
Exercise 7 - Learn Ruby the Hard Way
This file contains hidden or 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
# the method puts prints the string | |
puts "Mary had a little lamb." | |
# the method puts prints the string and using string interpolation | |
# embeds the variable snow into the string | |
puts "It's fleece was white as %s." % 'snow' | |
# the method puts prints the string | |
puts "Everywhere that Mary went." | |
# the method puts prints the integer 10 | |
puts "." * 10 # What did that do? | |
# variable are assigned | |
end1 = "C" | |
end2 = "h" | |
end3 = "e" | |
end4 = "e" | |
end5 = "s" | |
end6 = "e" | |
end7 = "B" | |
end8 = "u" | |
end9 = "r" | |
end10 = "g" | |
end11 = "e" | |
end12 = "r" | |
# the method puts prints the concatonated variables | |
puts end1 + end2 + end3 + end4 + end5 + end6 | |
puts end7 + end8 + end9+ end10 + end11 + end12 | |
# the printf method prints to the screen but does not make a line return | |
printf "Cheeseyburger" | |
# the method puts is creating a blank line in the terminal | |
puts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment