Пространства имён
Варианты
Действия

continue statement

Материал из cppreference.com

 
 
Язык C
Общие темы
Препроцессор
Комментарии
Ключевые слова
Таблица ASCII
Escape-последовательности
История C
Управление программой
Операторы условного выполнения
Операторы повторения
Операторы перехода
оператор continue
оператор break
Функции
объявление функции
спецификатор inline
Типы
Спецификаторы
cv-спецификаторы
спецификаторы продолжительности хранения
спецификатор alignas (C99)
Литералы
Выражения
порядок вычисления
альтернативные операторы
операторы
приоритет операторов
Утилиты
typedef-объявление
атрибуты (C99)
приведения типов
Разное
Ассемблерные вставки
 
тело цикла пропустил.
Используется, когда это иначе неудобно игнорировать оставшуюся часть цикла использованием условных операторов.
Original:
Used when it is otherwise awkward to ignore the remaining portion of the loop using conditional statements.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

[править] Синтаксис

continue

[править] Объяснение

Этот оператор работает в качестве ярлыка к концу вмещающих тела цикла.
Original:
This statement works as a shortcut to the end of the enclosing loop body.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
петли, следующая инструкция выполняется это условие проверки (cond_expression). В случае петля for, следующий инструкций, выполняемых являются выражением итерации и проверка состояния (iteration_expression, cond_expression). После этого цикл продолжается в нормальном режиме.
Original:
In case of while or
делать-то время
Original:
do-while
The text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
</div>
loops, the next statement executed is the condition check (cond_expression). In case of for loop, the next statements executed are the iteration expression and condition check (iteration_expression, cond_expression). After that the loop continues as normal.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Ключевые слова

continue

[править] Пример

#include <stdio.h>
 
int main()
{
    for (int i = 0; i < 10; i++) {
        if (i != 5) continue;
        printf("%d ", i);       //this statement is skipped each time i!=5
    }
 
    printf("\n");
 
    for (int j = 0; j < 2; j++) {
        for (int k = 0; k < 5; k++) { //only this loop is affected by continue
            if (k == 3) continue;
            printf("%d%d ", j, k);    //this statement is skipped each time k==3
        }
    }
}

Вывод:

5
00 01 02 04 10 11 12 14