Remainder in switch | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

Remainder in switch

Why does the output of attached code only give numbers to 100 instead of the asked strings? It seems it doesnt run the switch loop? :s

3rd Jan 2019, 2:38 PM
Jens Cobben
Jens Cobben - avatar
2 Answers
+ 10
Try this switch(true){ case(i%3==0): ... } or switch(i%3){ case(0): ... }
3rd Jan 2019, 3:20 PM
Mert Yazıcı
Mert Yazıcı - avatar
Oke :D thanks alot. Gonna try other approach
3rd Jan 2019, 2:49 PM
Jens Cobben
Jens Cobben - avatar