Printing strings

In the preceding code snippet, we're printing out a string that we have properly wrapped in quotation marks. Note that both single and double quotation marks work properly.

It's also important that you do not mix the quotation mark types. For example, run the following code:

puts "Name an animal' 

You will get an error, because you need to ensure that every quotation mark is matched with a closing (and matching) quotation mark.

If you start a string with a double quotation mark, the Ruby parser requires that you end the string with a matching double quotation mark.