+ 2
How do i break out of this loop
public static void newfunct() { boolean continueprg = true; while (continueprg= true){......... continueprg = false; break;} i tried this method but it couldn't break out from the loop
3 Respuestas
+ 13
while (continueprg) {...}
or
while (continueprg==true) {...}
== checks for equality
= is the assignment operator, it sets your variable always back to true in your example.
+ 6
or simply use while (continueprg){...}
+ 4
You should use "==" in while condition
ex. while (continueprg == true) { }
or while (continueprg) { }