While Loop - Equivalent Constructs

Equivalent Constructs

while (condition) { statements; }

is equivalent to

if (condition) { do { statements; } while (condition); }

or

while (true) { if (!condition) break; statements; }

or

goto TEST; LOOPSTART: statements; TEST: if (condition) goto LOOPSTART;

or

TEST: if (!condition) goto LOOPEND; statements goto TEST; LOOPEND:

Also, in C and its descendants, a while loop is a for loop with no initialization or counting expressions, i.e.,

for ( ; condition; ) { statements; }

}

Read more about this topic:  While Loop

Famous quotes containing the words equivalent and/or constructs:

    Perhaps basketball and poetry have just a few things in common, but the most important is the possibility of transcendence. The opposite is labor. In writing, every writer knows when he or she is laboring to achieve an effect. You want to get from here to there, but find yourself willing it, forcing it. The equivalent in basketball is aiming your shot, a kind of strained and usually ineffective purposefulness. What you want is to be in some kind of flow, each next moment a discovery.
    Stephen Dunn (b. 1939)

    In some extremely important ways, people are what you expect them to be, or at least they behave as you expect them to behave.
    Naomi Weisstein, U.S. psychologist, feminist, and author. Psychology Constructs the Female (1969)