While loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

While loops

hey i just messing around with codes and i want the loop to skip 50 and go on, but what i got is, it is executed 50 for like infinite times. public class Program { public static void main(String[] args) { int x = 10; while(!(x > 100)) { System.out.println(x); if(x == 50) { continue; } x=x+10; } } } this might be a silly question but i just started yesterday and i don't know much. But can you please give me a solution? THX

9th Aug 2020, 7:34 AM
M.O.HONOR
M.O.HONOR - avatar
1 Answer
+ 2
Your explanations helped me but the fix doesn't work but what i did to fix it was just to changed the order of the print function and the increment. The first output is 20 tho but i want to make it 10. So i just decided to make the x variable to 0 :D
9th Aug 2020, 9:19 AM
M.O.HONOR
M.O.HONOR - avatar