Syntax Errors :: 0x01

Not all syntax errors raise exceptions. Sometimes they lead to unintended behavior instead.

Consider the following code sample:

greeting = "Howdy"

puts '#{greeting} World!'

What will go wrong when this program runs, and how can it be fixed?

[ANSWER] To reveal the answer, hover or tap on this box and then click the eye icon.

 Intended output: Howdy World!

   Actual output: #{greeting} World!

 ...

 This happens because single quoted string literals behave differently
 than double quoted string literals.

 Single quoted strings are meant to represent raw text and so they
 don't support the #{...} interpolation operator.

 ...

 Using double quotes instead of single quotes would fix the issue with
 this code and make the program work as intended.

Related Notes :: 0xF002