+ 3
I can not find WHY? output is 0123456789? instead of odd numbers 13579?
https://code.sololearn.com/wop3D19BTpY1/?ref=app <?php for($i=0; $i<10; $i++) { if ($i%2==10){ continue; } echo $i. ’’; } ?>
4 Antworten
+ 3
https://code.sololearn.com/w9k79g83qVU1/#php
CHANGE:
if ($i%2==10)
TO:
if ($i%2==0)
The problem is that you're seeing if the remainder equals 10, rather than 0. If you change it to 0, then if it's even it'll return 0 and you can continue with next iteration. If it's odd number, it'll return 1.
+ 3
Oh Yes👍!!
Thank You ;>)
I understand what had happened when I corrected it.
+ 3
You're more than welcome, Jan! Best of luck to you with your learning.
+ 1
😂😂😂😂sweet mistake...