Multi-line variable

Hi,

is there any Ruby equivalent to:

php:

$var = <<<END

sometext
sometext
sometext

END;

so I can write multiline in a single variable ?

Regards.

On 06/11/06, Googled [email protected] wrote:

sometext

END;

so I can write multiline in a single variable ?

Regards.
Almost the same syntax:
irb(main):001:0> var =<<END
irb(main):002:0" sometext
irb(main):003:0" sometext
irb(main):004:0" sometext
irb(main):005:0" END
=> " sometext\n sometext\n
sometext\n"

Farrel

Thank you very much :slight_smile:

there are small variations on the theme:

http://www.zenspider.com/Languages/Ruby/QuickRef.html#8

<<identifier - interpolated, goes until identifier
<<“identifier” - same thing
<<‘identifier’ - no interpolation
<<-identifier - you can indent the identifier by using “-” in front

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs