A
Anthony Ob
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]
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]