search

Home  >  Q&A  >  body text

Is there something wrong with my comments? Why does the final result output 13?


Is there something wrong with my annotation?

1.jpg

在路上在路上1944 days ago1284

reply all(2)I'll reply

  • 王林

    王林2019-08-21 17:38:47

    It’s indeed 13. You may have misread that place. Please take a look

    reply
    0
  • 匿名

    匿名2019-07-30 16:48:08

    Basic rules: ++ is in front, add first and then perform operations; ++ is in the back, perform operations first and then add.

    $foo = 5+5; Equal to 6;

    $cup = 6+7; x and y are calculated first and then decremented, x=5, y=6;

    $paper = 6+6; first + + is in front of x, first add 1, x=6; the second ++ is after x, then add one after the operation, x=7;

    $water = 6+7=13; two --are after the variable, the expression will be decremented after the operation is completed, x=6, y=5;

    reply
    2
  • Cancelreply