# Curiosity about syntax for multi-line statements

**URL:** <https://www.ruby-forum.com/t/curiosity-about-syntax-for-multi-line-statements/171631>\
**Category:** Rails\
**Created:** [July 6, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/curiosity-about-syntax-for-multi-line-statements/171631 "2009-07-06T20:55:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [July 6, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/curiosity-about-syntax-for-multi-line-statements/171631/1 "2009-07-06T20:55:10Z")

</div>

Hi,

I posted at [http://www.pastie.org/536025](http://www.pastie.org/536025) four different continuation  
schemes for a lengthy statement. The first three work fine, but the  
fourth fails. (The question arose as I was importing columnar  
positions for selected columnar headings in a CSV file.)

Did I make a mistake or did the Ruby parser?

I’m running:  
ruby 1.8.6  
WinXP-Pro/SP2

Thanks in advance,  
Richard

---

<div class="post-metadata">

**Author:** ![RichardOnRails](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e0b2c6/32.png) [@RichardOnRails](https://www.ruby-forum.com/u/RichardOnRails)\
**Post date:** [July 6, 2009, 9:03pm UTC](https://www.ruby-forum.com/t/curiosity-about-syntax-for-multi-line-statements/171631/2 "2009-07-06T21:03:21Z")

</div>

On Jul 6, 2009, at 11:54 AM, RichardOnRails wrote:

> Hi,
> 
> I posted at [http://www.pastie.org/536025](http://www.pastie.org/536025) four different continuation  
> schemes for a lengthy statement. The first three work fine, but the  
> fourth fails. (The question arose as I was importing columnar  
> positions for selected columnar headings in a CSV file.)
> 
> Did I make a mistake or did the Ruby parser?

Fails how? As is, with my install (ruby 1.8.6 (2008-08-11 patchlevel  
287) [universal-darwin9.0]) I get this for the 4th:

1. 

%s = %d  
%s = %d  
Date = 0

But don’t get an error. I think it’s a precedence problem. My guess  
is % binds tighter than +, but I haven’t verified that. Adding some  
()'s around the strings and it works like you’d expect.

puts (“4.\n %s = %d\n” +  
" %s = %d\n" +  
" %s = %d\n") % [  
:Date.to\_s, date,  
:Description.to\_s, description,  
:Amount.to\_s, amount]
