Joshua Ballanco wrote: > On Nov 9, 2009, at 6:35 AM, Seebs wrote: > >> On 2009-11-09, Marnen Laibow-Koser <marnen / marnen.org> wrote: >>> Would you? Or would you rather see >>> count = blahblahblah.count do |args| >>> lots_of_stuff >>> condition >>> end >> Huh! That is prettier. Didn't know it existed. >> >> But in general, basically, any place where we have a += 1, I'd prefer ++. >> >> And I am pretty sure that +=1 is occasionally useful. > > ..and *this* is where, in the long long history of this thread, where I finally realized the *real* issue here. > > Let's take Rails... rails, activerecord, activeresource, actionpack, actionmailer, and activesupport... > > 106,518 lines of Ruby code > > 66 instances of foo += 1 (or foo += 100) > > That's 0.06% of the lines of code! If you're writing Ruby code and your fraction is higher, chances are you're "doing it wrong". > Or your style of programming is different than the programmer(s) in the code you researched. As an example earlier in the thread I showed one way to separate the city, state, and zip code from a string, at least two other authors showed totally different methods. They all returned the same results so which one was right? One used regular expressions and the other used split and map. x = x + 1 returns the same result as x += 1 but is probably easier for some people to understand quickly. > Cheers, > > Josh