I’m currently learning Ruby, and I’ve come across a weird snag in the tutorial I’m using. I’m using this exercise from Learn Ruby The Hard Way, and it keeps producing a syntax error, and I can’t figure out why.
The code I’m trying to use is
puts <<-'HERE'
There's something going on here.
With the PARAGRAPH thing
We'll be able to type as much as we like.
Even 4 lines if we want, or 5, or 6.
HERE
But, it always produces the following syntax error
ex9.rb:12: syntax error, unexpected tIDENTIFIER, expecting $end
We'll be able to type as much as we like.
^
Any help would be appreciated! I’m using TextWrangler, and TextWrangler parses it as a block quote, but Ruby is not.
Although it does not seem like it in the code snippet you posted, you probably did have a space on both or one side of the
-in<<-'HERE'.If you do, you will likely see warnings like this: