Is there something wrong with my annotation?
It’s indeed 13. You may have misread that place. Please take a look
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;
It’s indeed 13. You may have misread that place. Please take a look
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;