From: "Brian Schröder" Date: 2005-05-13T00:51:31+09:00 Subject: Re: {} vs begin/end [was Re: object loops and what they return] On 12/05/05, Jim Freeze wrote: > * Jim Weirich [2005-05-12 23:32:52 +0900]: > > > I use to pitch my tent in the one line => braces camp. But every time my > > one liner tent grew to more than one line, they made me repitch my tent > > using begin/end tent stakes. That's when I moved to the return value => > > brace camp. > > > > I came from the C camp, where everything looked like {}. > Since my editor supported matching these curly things, > I (usually) pitch camp at { || ... }. > Not sure I know where this return-value camp is at? > Anyone care to provide me a map? A simple example: print "100! = " puts (1..100).inject(1) { |r,v| r*v } (1..100).inject(1) do |r,v| puts "#{v}! = #{r*=v}" r end regards, Brian > > PS: The 'do || ... end' camp keeps telling me that my editor > will match 'do/end' pairs, but I always find the tents > are broken at that camp. > > > BTW, I do regularly hike up to the ternary operator camp as well, so I'll > > see you there. > > I too like this camp since it is a short hike, but since I > don't like strenuous activitiy, I never nest them. > > -- > Jim Freeze > Ruby: I can explain it to ya but I can't understand it fer ya. > > -- http://ruby.brian-schroeder.de/ Stringed instrument chords: http://chordlist.brian-schroeder.de/