Saturday 15 May 2010

java - Conditional conditions in a loop -



java - Conditional conditions in a loop -

is possible utilize different conditions loop depending on condition?

for example

boolean isdfa = true;

if isdfa true, want status of while loop be:

while(!s.hasalltransitions())

and otherwise, if isdfa false, want status of while loop be:

while(!input.equals("next"))

is using 2 separate loops way accomplish this?

you can combine conditions :

while((isdfa && !s.hasalltransitions()) || (!isdfa && !input.equals("next"))) { }

java conditional-statements

No comments:

Post a Comment