QUIZGUM

Coding Class

Quizgum : continue statement

Skip loops - Continue

If the loop encounters a continue statement while it is running, it skips one step.
The following example shows how to skip the continue statement when the value of variable i is 6.

<?php
    for($i = 0; $i <= 10; $i++){
        if($i == 6) continue;
        echo $i.'<br>';
    }
?>

Result

If you look at the result, you can see that 6 is not taken and goes on to the next turn.
Should we also do it in the while statement?

<?php
    $i = 0;
    $max = 10;

    while($i < $max){
        $i++;
        if($i == 6) continue;
        echo $i.'<br>';
    }
?>

Result