A simple example to illustrate what I'm talking about:
m=0; While[m<=50, m=m+1; p=m]
The result is:
In languages like Fortran or VB, the loop would stop exactly when m=51 and wouldn't do "p=m". The result would be:
How to program Mathematica to stop exactly when the condition is met?