+ 1

How can I be more effective with the continue statement?

Please help me understand the following code more efficiently: for ($i = 0; $i<=10; $i++) { if ($i%2 == 0) { continue; } echo $i . ' ' ; } // Output: 13579

7th Oct 2020, 10:06 AM
Jahangir Alom Minto
Jahangir Alom Minto - avatar
1 ответ
+ 1
a for loop that goes through each number 0-10 if the value of i is even (i % 2==0) skip it, if not, then echo the value of i
7th Oct 2020, 10:16 AM
Slick
Slick - avatar