do while syntax for java

do-while, java, while-loop

Solution

You probably meant

while (++i < 500);

instead of

while (++i == 500);

Problem

Ages since I have written a do while. Whats wrong with this do while ``` int i = 0; do { System.out.println(i); } while(++i == 500); ``` I only goes once through the loop, and IMO it should iterate 500 times.

Original source