Read the code in each section and predict the output generated by the last line of code. When you are finished, run the code in IRB to check your answers.
Example:
my_string = "Ada Lovelace"
my_string.slice(0...8)
# => "Ada Love"
my_string = "I love Seattle"
my_string.slice(7)
my_string = "I love Seattle"
my_string.slice(2, 4)
my_string = "I love Seattle"
my_string.slice("Seattle")
my_string = "Ada"
my_string + " Lovelace"
my_string = "Ada"
my_string << " codes" << " it!"
my_string = "Ada"
my_string.concat(" likes to code").slice(4...9)
my_string = "Hello world"
"Goodbye " + my_string.slice(6, 5) << "!"
my_string = "Hello world!"
my_string.slice(0...5).concat(", goodbye!")
my_string = "Hello world!"
my_string.slice(0) << "i" + "!"
my_string = "I love ruby"
my_string.slice(7, 4).concat(my_string.slice(2...6)) + my_string.slice(0)
my_string = "I love ruby"
"R".concat(my_string.slice(8, 3) + " rocks!")
my_string = "I love ruby"
my_string.slice(2, 4) << my_string.slice(7...11).concat(my_string.slice(2...6))