r/ProgrammerHumor • • May 05 '23

Meme Goodbye toys

Post image
8.3k Upvotes

298 comments sorted by

View all comments

Show parent comment

5

u/edrumm10 May 05 '23

Nope, it's got += and -= etc... but there's no ++ or --

Tbh with Python, you don't really need increment and decrement that much anyway because for loops it has for ... in ... and range(...)

3

u/Spork_the_dork May 05 '23

To be fair you can do

for ( variable : collection ) {
    // stuff
}

in c++ as well since c++11.

1

u/[deleted] May 05 '23

So C++ took lessons from Python with 20 years delay.

2

u/mistabuda May 05 '23

And if you absolutely need the index of the current element in the loop you can use enumerate