0
What sense make it to use before or after?
"Increment ++ The increment operator increments the numeric value of its operand by one. If placed before the operand, it returns the incremented value. If placed after the operand, it returns the original value and then increments the operand. Decrement -- " What for a sense does it make to write the operators before or after? Is there any example in programming in which it could make sense?
5 Antworten
+ 7
https://code.sololearn.com/WtONLWdnnoI0/?ref=app
Just Some little stuff
+ 6
Thirth code worked reversly while
Fourth code worked straight (because I added .reverse() method)
but as you can saw It's too long
And Fifth I gonna add later
This fifth connect to thirth which is useful and make your website faster
@Madera Oxidada
Wow Really?! I must test it later!
0
Pre increment is faster than post increment, so if you dont care which you use, you should always use ++x.
Im never going to get bored saying this, i think everyone should know it.
0
Than you guys! And @veryhard : thanks for showing but unfortunately I didn't get the last code in your example :/
0
@notsohard Yes. Pre increment just adds one to the variable, while post increment makes a copy, and then adds one to the original.