+ 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
1 Resposta
+ 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