[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: Syntax sugar idea for loops

Berger, Daniel

3/30/2005 7:42:00 PM


> -----Original Message-----
> From: Eric Hodel [mailto:drbrain@segment7.net]
> Sent: Wednesday, March 30, 2005 12:38 PM
> To: ruby-talk ML
> Subject: Re: Syntax sugar idea for loops
>
> people.each_with_index do |person, i|
> puts "First person: #{person} if person == people.first
> row_class = i.even? ? "row1" : "row2"
> puts "Last person: #{person} if person == people.last
> end
>
> How about that?

That'll work, too. :)

Dan



1 Answer

Bertram Scharpf

3/30/2005 8:33:00 PM

0

Hi,

Am Donnerstag, 31. Mär 2005, 04:41:43 +0900 schrieb Berger, Daniel:
>
> > -----Original Message-----
> > From: Eric Hodel [mailto:drbrain@segment7.net]
> >
> > row_class = i.even? ? "row1" : "row2"
> >
> > How about that?
>
> That'll work, too. :)

No, it won't. Therefore I proposed my even/odd patch at

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby...

Your answer 4513 seems not to be accessible at the archive.
I remember you preferred the Ruby solution rather than the C
issue.

I still hope this feature once will be applied.

Bertram


--
Bertram Scharpf
Stuttgart, Deutschland/Germany
http://www.bertram-...