Avoid warning twice

Fix warning twice problem.
when i > nmax, maximum number of iterations reached.
when i == nmax. it should run the ' while loop ' again and not print warning.

Another way, you don't need delete ' = ', just swap the two line, see below

line 104 if (i >= nmax) warning('Maximum number of iterations reached!')
line 105 i = i + 1