0

why in this code the output increment 2 number inside the code while the i == 0🤔🤔🤔

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

24th May 2017, 12:35 AM
Shroq Khaled Mahdi Al-Nabhani
Shroq Khaled Mahdi Al-Nabhani - avatar
1 Odpowiedź
+ 3
continue; moves the loop back to the top (or the next itteration). So when the continue statement is reached, the for loop is considered done and i is incremented from the i++.
24th May 2017, 12:51 AM
Rrestoring faith
Rrestoring faith - avatar