Okay then. Glad to help.
Type: Posts; User: GregBrannon
Okay then. Glad to help.
Oh (disappointed). You couldn't figure out how to do 1/2?
Little details like using 1 or 2 instead of YES/NO are fundamental to the design, not helpful tips.
This is nothing you can't do, but here's an elementary example. You can figure out how to...
Close.
while (again = true)
'=' is an assignment operator. Further, a comparison using a boolean is unnecessary simply:
while ( again )
will do (as I showed originally).
Then,
There's no such thing as a "YES/NO Loop" in Java.
By using an if statement to set a flag ('again' in my example) that indicates whether the loop will repeat. My example does everything but write...
Using a while loop, the general form is:
while ( again )
{
// the code to repeat
// ask the user if the loop should repeat,
// if yes, again stays true
// if no, again =...