27 ms·
++x and x++ just seem so unnecessary. Two extra operators for a very specific case, in which they either safe one character verses x+=1 or mix different mutatio
by skitter 4y ago
++x and x++ just seem so unnecessary. Two extra operators for a very specific case, in which they either safe one character verses x+=1 or mix different mutations into the same line. Iterating a list by incrementing an index doesn't even come up that often if your language supports iterators well.
Edit: Just checked, the project I just had open has 7 instances of +=1 in 5k loc and none of them would have been improved by ++
- Alupis 4y agoWell, Lua also does not support += or any of it's counterparts. You have to be extremely literal with x = x + 1, which is just a huge waste for very little gain. I'm all for beginners learning easier constructs... teach them x = x + 1 if you want, just don't remove the shorter constructs for the rest of us. Iterating a list/array is just one of many use cases for the increment/decrement operators anyway...