From: Helge Elvik Date: 2006-06-27T22:55:36+09:00 Subject: Re: newbie doesn't understand why's example This one got me a bit also at first, but it's like others have said. Maybe this will make it clearer: class Array # Build a string from this array, formatting each entry # then joining them together. def join( sep = $,, format = "%s" ) collect do |item| sprintf( format, item ) end.join( sep )<<< writes: > in why's poignant guide to ruby... > class ArrayMine < Array > # Build a string from this array, formatting each entry > # then joining them together. > def join( sep = $,, format = "%s" ) > collect do |item| > sprintf( format, item ) > end.join( sep )<<< end > end > why doesn't this loop recursively forever? what's happening here at the > big confusing stmt???? please explain....tia collect returns an Array, as has been said. Maybe it is clearer if you use a Variable: foo= collect do |item| sprintf( format, item ) end foo.join(sep)