continue loop continue

The role of continue is to just skip this loop, while the entire loop body continues to execute.

Statement structure:

for (initial condition; judgment condition; condition value update after loop)
{
  if (special case)
  { continue; }
 loop code
}

In the above loop, when a special situation occurs, this loop will be skipped, and subsequent loops will not be affected. For example, output 10 numbers, if the number is 5, it will not be output.

Results of the:

Note: In the above code, the loop with num=5 will be skipped.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326542450&siteId=291194637