Skip to content

Instantly share code, notes, and snippets.

@jendiamond
Last active December 21, 2015 18:39
Show Gist options
  • Save jendiamond/6348432 to your computer and use it in GitHub Desktop.
Save jendiamond/6348432 to your computer and use it in GitHub Desktop.
Exercise 6 - Learn Ruby the Hard Way
# the variable x is being assigned with the following string;
# Using string interpolation the integer 10 is embeded inside the string
x = "There are #{10} types of people."
# the variable binary is being assigned with the string binary
binary = "binary"
# the variable don't is being assigned with the string do_not
do_not = "don't"
# the variable y is being assigned with the following string
# Using string interpolation the variable binary and do_not is embeded inside the string
y = "Those who know #{binary} and those who #{do_not}."
# the method puts prints the variable x to the screen
puts x
# the method puts prints the variable y to the screen
puts y
# the method puts prints the string and using string interpolation
# embeds the variable x
puts "I said: #{x}."
# the method puts prints the string to the screen;
# using string interpolation it embeds the variable y
puts "I also said: '#{y}'"
# the variable hilarious is being assigned with the boolean value false
hilarious = false
# the method puts prints the string and using string interpolation
# embeds the variable y
joke_evaluation = "Isn't that joke so funny?! #{hilarious}"
# the method puts prints the variable joke_evaluation
puts joke_evaluation
# the variable w is being assigned with the following string
w = "This is the left side of..."
# the variable e is being assigned with the following string
e = "a string with a right side."
# the method puts prints the variables w and e
puts w + e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment