Click to See Complete Forum and Search --> : java not looping?


bobtcowboy
02-03-2002, 12:41 AM
Any ideas as to why this isn't looping?

(those functions are listed in the rest of the file, which I snipped for brevity


public static void main (String[] args)
{
for (int counter = 0; counter <= 3; counter++)
{ while ((p1 != r) && (p2 != r))
{ flipper();
coinFlip();
heads();
tails();
gameStatus();
}
}
}

Energon
02-03-2002, 03:53 AM
My only guesses since you don't actually show anything about p1 or p2 is that one of them is == r... that's the condition for the while loop, so that's where you should start. Either that or somewhere you set counter to be greater than or equal to 3, so the for loop breaks.

bobtcowboy
02-03-2002, 03:51 PM
Originally posted by Energon:
<STRONG>My only guesses since you don't actually show anything about p1 or p2 is that one of them is == r... that's the condition for the while loop, so that's where you should start.</STRONG>


Bless your heart. You're awesome. My friend had forgotten to reset that after the while loop

Bill