# Tutorial help

**URL:** <https://www.ruby-forum.com/t/tutorial-help/195579>\
**Category:** Ruby\
**Created:** [September 25, 2010, 9:25pm UTC](https://www.ruby-forum.com/t/tutorial-help/195579 "2010-09-25T21:25:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthonyob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a3d4f5/32.png) [@anthonyob](https://www.ruby-forum.com/u/anthonyob)\
**Post date:** [September 25, 2010, 9:25pm UTC](https://www.ruby-forum.com/t/tutorial-help/195579/1 "2010-09-25T21:25:55Z")

</div>

> **[Learn How to Blog and Build Websites for Profit!](https://heyblogging.com)**
>
> Ready to take your blogging skills to the next level? Learn how to build a website that generates income and sets you up for success.

the a =\<\<END\_STR  
spits out an error  
Here is what I coded with the tutorial

[code/]#p004stringusage.rb  
#defining a constant  
PI = 3.1416  
puts PI

# Defining a local variable

myString = ‘I love my city, Pune’  
puts myString  
=begin  
conversions  
.to\_i, .to\_f, .to\_s  
=end  
var1=5;  
var2=‘2’  
puts var1+var2.to\_i  
#\<\< appending to a string  
a=‘hello’  
a\<\<‘world.  
I love this world…’  
puts a  
=begin \<\< marks the start of the string literal and is followed by a  
dlimiter of your choice. The string literal then starts from the next  
new line and finishes when the delimiter is repeated again on a line  
of it own. This is know as Here document syntax.  
=end  
a = \<\<END\_STR  
#This is the string and a second line  
ENG\_STR  
puts a[/code]

---

<div class="post-metadata">

**Author:** ![anthonyob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a3d4f5/32.png) [@anthonyob](https://www.ruby-forum.com/u/anthonyob)\
**Post date:** [September 25, 2010, 9:56pm UTC](https://www.ruby-forum.com/t/tutorial-help/195579/2 "2010-09-25T21:56:45Z")

</div>

Anthony Ob wrote:

> [http://rubylearning.com/satishtalim/variables\_and\_assignment.html](http://rubylearning.com/satishtalim/variables_and_assignment.html)
> 
> the a =\<\<END\_STR  
> spits out an error  
> Here is what I coded with the tutorial
> 
> [code/]#p004stringusage.rb  
> #defining a constant  
> PI = 3.1416  
> puts PI
> 
> # Defining a local variable
> 
> myString = ‘I love my city, Pune’  
> puts myString  
> =begin  
> conversions  
> .to\_i, .to\_f, .to\_s  
> =end  
> var1=5;  
> var2=‘2’  
> puts var1+var2.to\_i  
> #\<\< appending to a string  
> a=‘hello’  
> a\<\<‘world.  
> I love this world…’  
> puts a  
> =begin \<\< marks the start of the string literal and is followed by a  
> dlimiter of your choice. The string literal then starts from the next  
> new line and finishes when the delimiter is repeated again on a line  
> of it own. This is know as Here document syntax.  
> =end  
> a = \<\<END\_STR  
> #This is the string and a second line  
> ENG\_STR  
> puts a[/code]

btw here is the error message  
p004stringusage.rb:28: can’t find string “END\_STR” anywhere before EOF  
p004stringusage.rb:25: syntax error, unexpected $end, expecting  
tSTRING\_CONTENT  
or tSTRING\_DBEG or tSTRING\_DVAR or tSTRING\_END

---

<div class="post-metadata">

**Author:** ![anthonyob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a3d4f5/32.png) [@anthonyob](https://www.ruby-forum.com/u/anthonyob)\
**Post date:** [September 25, 2010, 10:33pm UTC](https://www.ruby-forum.com/t/tutorial-help/195579/3 "2010-09-25T22:33:02Z")

</div>

Hi,

On 25.09.2010 22:01, Anthony Ob wrote:

> Anthony Ob wrote:
> 
> > [http://rubylearning.com/satishtalim/variables\_and\_assignment.html](http://rubylearning.com/satishtalim/variables_and_assignment.html)
> 
> btw here is the error message  
> p004stringusage.rb:28: can’t find string “END\_STR” anywhere before EOF  
> p004stringusage.rb:25: syntax error, unexpected $end, expecting  
> tSTRING\_CONTENT  
> or tSTRING\_DBEG or tSTRING\_DVAR or tSTRING\_END

Oh … it’s a tricky one. I tried it myself and the problem is caused due  
the trailing whitespace on the lines containing END\_STR. They come from  
copying the example from the web page.

Simply remove them and the example should work.

HTH

---

<div class="post-metadata">

**Author:** ![anthonyob](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a3d4f5/32.png) [@anthonyob](https://www.ruby-forum.com/u/anthonyob)\
**Post date:** [September 25, 2010, 10:43pm UTC](https://www.ruby-forum.com/t/tutorial-help/195579/4 "2010-09-25T22:43:48Z")

</div>

Markus F. wrote:

> Hi,
> 
> On 25.09.2010 22:01, Anthony Ob wrote:
> 
> > Anthony Ob wrote:
> > 
> > > [http://rubylearning.com/satishtalim/variables\_and\_assignment.html](http://rubylearning.com/satishtalim/variables_and_assignment.html)
> > 
> > btw here is the error message  
> > p004stringusage.rb:28: can’t find string “END\_STR” anywhere before EOF  
> > p004stringusage.rb:25: syntax error, unexpected $end, expecting  
> > tSTRING\_CONTENT  
> > or tSTRING\_DBEG or tSTRING\_DVAR or tSTRING\_END
> 
> Oh … it’s a tricky one. I tried it myself and the problem is caused due  
> the trailing whitespace on the lines containing END\_STR. They come from  
> copying the example from the web page.
> 
> Simply remove them and the example should work.
> 
> HTH

Lmao im such a noob; Instead of a D in END\_STR I put G. smh Thanks for  
the help!
