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:

    The notion that one will not survive a particular catastrophe is, in general terms, a comfort since it is equivalent to abolishing the catastrophe.
    Iris Murdoch (b. 1919)

    To me the “female principle” is, or at least historically has been, basically anarchic. It values order without constraint, rule by custom not by force. It has been the male who enforces order, who constructs power structures, who makes, enforces, and breaks laws.
    Ursula K. Le Guin (b. 1929)