Long string assignment

Hi,

In php, I can use the following code :

$str = <<<aa
hello,
how are you?
aa
;

But how can I do this in ruby ?

Thank you.

Alle lunedì 11 giugno 2007, w wg ha scritto:

But how can I do this in ruby ?

Thank you.

str = <<EOS
hello,
how are you?
aa
EOS

Stefano

Thank you very much. it works.

2007/6/11, Stefano C. [email protected]:

On 11.06.2007 16:26, w wg wrote:

But how can I do this in ruby ?
str = <<aa
hello,
how are you?
aa

or

with interpolation, not shown in this example

str = %Q{aa
hello,
how are you?
}

or

without interpolation

str = %q{aa
hello,
how are you?
}

Kind regards

robert

On 6/11/07, Rick DeNatale [email protected] wrote:

or even just

str = %{aa
hello
how are you?
)

Oops, I meant either

str = $(aa
hello
how are you?
)

or

str = ${aa
hello
how are you?
}

On 6/11/07, Robert K. [email protected] wrote:

or

without interpolation

str = %q{aa
hello,
how are you?
}

or even just

str = %{aa
hello
how are you?
)


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/

On 6/11/07, Phrogz [email protected] wrote:

str = %{aa

puts str
#=> aa
#=> hello
#=> how ara you?
#=> FULL OF INTERPOLATION GOODNESS

Thanks, I corrected my initial typo without too much thought.


Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

On Jun 11, 12:34 pm, “Rick DeNatale” [email protected] wrote:

hello
how are you?
)

msg = “FULL OF INTERPOLATION GOODNESS”
str = %{aa
hello
how ara you?
#{msg}
}

puts str
#=> aa
#=> hello
#=> how ara you?
#=> FULL OF INTERPOLATION GOODNESS