HPlogo HP C/HP-UX Reference Manual: Workstations and Servers > Chapter 6 Statements

The continue Statement

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

The continue statement is used to transfer control during the execution of an iteration statement.

Syntax

continue;

Description

The continue statement unconditionally transfers control to the loop- continuation portion of the most tightly enclosing iteration statement. You cannot use the continue statement without an enclosing for, while, or do statement.

In a while statement, a continue causes a branch to the code that tests the controlling expression.

In a do statement, a continue statement causes a branch to the code that tests the controlling expression.

In a for statement, a continue causes a branch to the code that evaluates the increment expression.

Example

For example:

for (i=0; i<=6; i++)
if(i==3) continue;
else printf("%d\n",i);

This example prints:

     0
1
2
4
5
6