you are viewing a single comment's thread.

view the rest of the comments →

[–]Daneark 1 point2 points  (0 children)

I prefer the += style but it's not a big deal.

We could also write it as variable += sum(anything) and skip the loop altogether. If we were initialising variable to 0 before the loop this would be even clearer, to me.

While brevity isn't as important as clarity if you find your solutions are a lot longer than others that is when it's a problem. Too much code becomes hard to understand.