skip -3 and -6 in the for loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

skip -3 and -6 in the for loop?

I have the proper range in loop but I am struggling with properly skipping -3 and -6 from that range of -300 to 0. Please assist https://code.sololearn.com/WmvOs9ROa5H0/#js

20th Jan 2019, 11:10 PM
Ran9
Ran9 - avatar
3 Answers
+ 1
Add this before the if statement in the loop: if(i === -3 || i === -6) continue;
20th Jan 2019, 11:52 PM
Vaas
Vaas - avatar
+ 3
for (var i= -300; i<=0, i!=-3, i!=-6;i++){ do stuff; }
20th Jan 2019, 11:19 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
worked thanks guys
21st Jan 2019, 12:09 AM
Ran9
Ran9 - avatar