[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to write ruby in multiple lines

anakintang

5/9/2007 6:07:00 PM

All,

How can I write "s = s1 + s2 + s3" in multiple lines like below:

s= s1
+ s2
+ s3

Thanks

--
Posted via http://www.ruby-....

3 Answers

Sylvain Joyeux

5/9/2007 6:20:00 PM

0

On Wednesday 09 May 2007, anakintang wrote:
> All,
>
> How can I write "s = s1 + s2 + s3" in multiple lines like below:
>
> s= s1
> + s2
> + s3
>
> Thanks

Like that
s = s1 +
s2 +
s3

or

s = s1 + s2 + s3

AFAIK, the first form is more in use than the second.



--
Sylvain Joyeux

Pit Capitain

5/9/2007 6:20:00 PM

0

anakintang schrieb:
> How can I write "s = s1 + s2 + s3" in multiple lines like below:

s= s1 + s2 + s3

Regards,
Pit

Glen Pfeiffer

5/9/2007 10:20:00 PM

0

On 05/09/2007 11:19 AM, Sylvain Joyeux wrote:
> On Wednesday 09 May 2007, anakintang wrote:
>> How can I write "s = s1 + s2 + s3" in multiple lines like
>> below:
>
> Like that
> s = s1 +
> s2 +
> s3
>
> or
>
> s = s1 > + s2 > + s3
>
> AFAIK, the first form is more in use than the second.

In the example given, which is obviously contrived, it makes
little difference. But when s1, s2, and s3 are longer
expressions, I find that the second version is more readily
grokked.

Without looking at the end of a line, you can tell that it is a
continuation of a previous line, and while at the end of a line
to can tell that it is continued.

That's my $0.02

--
Glen