posted 9 years ago
Welcome to the Ranch.
Rule about pre/post-fix in/decrement:
i++ or i-- = postfix = assign then increment/decrement
++i or --i = prefix = increment/decrement then assign
[edit]
looking at the while loop, given i=10 (postfix)
first iteration the checking is 10<=10 and this is true, the i increments to 11
inside the loop i gets increments again now i=12
second iteration the checking is 12<=10 and this is false, the i increments to 13 exit loop
prints 13.
K. Tsang CEng MBCS PMP PMI-ACP OCMJEA OCPJP