0
Never coded before... I know video says x++ is same as saying x=x+1 but why do we use this x++ in this code? in other words why
7 Réponses
+ 10
@Sachin Artani
That longest world comment ever again \(O_O)/
+ 7
x=x+1
Return x 2 times
While x++
Return x 1 time
So x++ is the faster way
+ 5
For better speed, developers reduce a little burden of programmers by reducing length of instructions.
It's completely on you to use x++ or x=x+1, both results the same.
Also, if you want to know the difference between x++ and ++x, please check this code-
https://code.sololearn.com/cjHQRJUG5NTf/?ref=app
+ 5
😁😁😁 @Very hard,
yes! I sorted out everything I knew about ++x and x++ in a single code.
+ 3
is more easy to type
x++
than
x=x+1
furthermore x++ have more 'semantic meaning' that is to say, express better what we need to do
0
It is not only a matter of speed or length of code. The assignment operator (=) returns the value of th right hand expression (in that case, x+1), while x++ returns the value of x before incrementing.
0
how to write algorithms because when it comes to codes I'm a bit good, I'd need someone to help me with how to write an algorithm when it comes to conditions and loops