Solve the problem of ++
MrSwan
MrSwan 2018-04-12 12:56:09
0
3
1573

var x=10;

var y=20;

y = x;//y=31

y=x y;//y=30

Why are the values ​​different? Isn’t y=x y 31?

MrSwan
MrSwan

reply all(1)
灭绝师太

Because when the code is parsed, it is not parsed into

x+ ++y

but into

x++ +y


  • reply Oh oh oh, okay, thank you teacher
    MrSwan author 2018-04-12 13:06:27
  • reply ++x increases by 1 before use; x++ increases by 1 after use.
    灭绝师太 author 2018-04-12 13:09:51
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template