[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Re: each with separator

Gavin Kistner

10/20/2004 6:47:00 PM

[1,2,3].separate_by { puts "-" }.each {|obj|
puts obj
}

desired output:

1
-
2
-
3


puts [1,2,3].collect{ |o| o.to_s }.join( "\n-\n" )

I feel certain that I'm missing the real point of separate_by, but there you have it, FWIW.