answersLogoWhite

0

A loop in computer languages is a set of statements that execute repeatedly, based on some criteria.

In C and C++, the three looping statements are while, do, and for...

while (test-expression) statement;
/* statement executes zero or more times, until test-expression is false, test first */

do statement while (test-expression);
/* statement executes one or more times, until test-expression is false, test last */

for (init-expression, test-expression, loop-expression) statement;
/* init-expression executed once, at beginning */
/* statement executes zero or more times, until test-expression is false, test first */
/* loop-expression evaluated at end of each iteration */

Often, statement, is a set of statements, such as...

while (test-expression) {
... statements
}

User Avatar

Wiki User

15y ago

What else can I help you with?