Very Newbie Question

does a syntax/facility to wrap long expression lines exist in ruby

eg

fred = amy + bill
+ clara + dora
+ eddid

rather than

fred = amy + bill + clara + dora + eddie

tia

Ragweed wrote:

does a syntax/facility to wrap long expression lines exist in ruby

eg

fred = amy + bill
+ clara + dora
+ eddid

Expressions can be split into separate lines as long as it is clear that
the expression hasn’t ended yet.

fred = amy + bill +
clara + dora +
eddid

Or you could use the \ sign at the end of the line.

fred = amy + bill
+ clara + dora
+ eddid

···


([ Kent Dahl ]/)_ ~ [ http://www.stud.ntnu.no/~kentda/ ]/~
))_student
/(( _d L b_/ NTNU - graduate engineering - 5. year )
( __õ|õ// ) )Industrial economics and technological management(
_
/ö____/ (_engineering.discipline=Computer::Technology)

I’ll make a slightly-related comment. I’ve spent several hours trying
to coerce Vim into indenting the following code as is (assuming a
shiftwidth setting of 2):

x = a +
b + c

Vim in fact wants to indent it like this:

x = a +
b + c

Not Very Nice. Of course, the fact that Ruby has no explicit
statement separator makes life difficult for this sort of thing.

I’m just informing the list of this so that if there is a Vim
superuser out there looking for a challenge, I’ve got one, and am
only to happy to collaborate if necessary. My several hours haven’t
been in vain, but I don’t believe I have releasable code.

Any comments on how FreeRIDE handles indenting in general and this
case in particular would be interesting.

Cheers,
Gavin

···

On Monday, March 17, 2003, 11:41:48 PM, Ragweed wrote:

does a syntax/facility to wrap long expression lines exist in ruby

eg

fred = amy + bill
+ clara + dora
+ eddid

rather than

fred = amy + bill + clara + dora + eddie

too easy! Thanks heaps.

Hate to admit I spent hours trying to work that out…

···

Expressions can be split into separate lines as long as it is clear that
the expression hasn’t ended yet.

fred = amy + bill +
clara + dora +
eddid

Or you could use the \ sign at the end of the line.

fred = amy + bill \

  • clara + dora \
  • eddid