◐ Shell
clean mode source ↗

continue statement - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

Usato quando è altrimenti difficile da ignorare la parte restante del loop usando istruzioni condizionali.

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.

Sintassi

continue

Spiegazione

Questa istruzione funziona come un collegamento alla fine del corpo del ciclo contiene.

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.

In caso di while o

do-while

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.

loop, l'istruzione successiva eseguito è il controllo di condizione (cond_expression). In caso di ciclo for, le dichiarazioni successive eseguite sono l'espressione di iterazione e verificare lo stato (iteration_expression, cond_expression). Dopo che il ciclo continua normalmente.

Original:

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Parole chiave

continue

Esempio

#include <iostream>

int main() 
{
    for (int i = 0; i < 10; i++) {
        if (i != 5) continue;
        std::cout << i << " ";       //this statement is skipped each time i!=5
    }
    
    std::cout << '\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;
            std::cout << j << k << " "; //this statement is skipped each time k==3
        }
    }
}

Output:

5
00 01 02 04 10 11 12 14