# Tutorial help

**URL:** <https://rubytalk.org/t/tutorial-help/60204>\
**Category:** ruby-talk\
**Created:** [25 September 2010 19:26 UTC](https://rubytalk.org/t/tutorial-help/60204 "2010-09-25T19:26:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anthony\_Ob](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Anthony\_Ob](https://rubytalk.org/u/Anthony_Ob)\
**Post date:** [25 September 2010 19:26 UTC](https://rubytalk.org/t/tutorial-help/60204/1 "2010-09-25T19:26:00Z")

</div>

[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]

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Anthony\_Ob](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Anthony\_Ob](https://rubytalk.org/u/Anthony_Ob)\
**Post date:** [25 September 2010 20:01 UTC](https://rubytalk.org/t/tutorial-help/60204/2 "2010-09-25T20:01:08Z")

</div>

Anthony Ob wrote:

> [Learn How to Blog and Build Websites for Profit!](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

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).

---

<div class="post-metadata">

**Author:** ![Markus\_Fischer](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Markus\_Fischer](https://rubytalk.org/u/Markus_Fischer)\
**Post date:** [25 September 2010 20:32 UTC](https://rubytalk.org/t/tutorial-help/60204/3 "2010-09-25T20:32:17Z")

</div>

Hi,

> **···**
>
> On 25.09.2010 22:01, Anthony Ob wrote:
> 
> > Anthony Ob wrote:
> > 
> > > [Learn How to Blog and Build Websites for Profit!](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:** ![Anthony\_Ob](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@Anthony\_Ob](https://rubytalk.org/u/Anthony_Ob)\
**Post date:** [25 September 2010 20:43 UTC](https://rubytalk.org/t/tutorial-help/60204/4 "2010-09-25T20:43:50Z")

</div>

Markus Fischer wrote:

> Hi,
> 
> > Anthony Ob wrote:
> > 
> > > [Learn How to Blog and Build Websites for Profit!](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!

> **···**
>
> > On 25.09.2010 22:01, Anthony Ob wrote:
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
