On Friday, November 7, 2003, 1:27:45 AM, Paul wrote:

> On Thu, Nov 06, 2003 at 11:17:59PM +0900, Yukihiro Matsumoto wrote:
>> In message "Re: ruby-dev summary 21637-21729"
>>     on 03/11/06, Paul Brannan <pbrannan / atdesk.com> writes:
>> |So what will the result of the above two lines of code be?
>> 
>> Plain syntax error in 1.9.x.

> Is the syntax error because of the first line or because of the second?
> I ask because I do this a lot in my code:

>   s = "this is a string " \
>       "that I have chosen to break " \
>       "into multiple lines

> I would be happy to switch to using heredocs if there were an easy way
> to indent heredocs.


  require 'extensions/all'    # http://extensions.rubyforge.org
  
  s = %{
    | this is a string
    | that I have chosen to break
    | into multiple lines
  }.trim('|')

  # or

  s = %{
    this is a string
    that I have chosen to break
    into multiple lines
  }.trim.tabto(0)

That would produce a three-line string, unlike your example, but you
mention indenting heredocs, so there you go.

Cheers,
Gavin