Is there any other way of creating a conditional execution?
way 1 : the obvious using “if”
if(condition)
{
doThis();
}
else
{
doThat();
}
way 2: other direct approach using “?”
(condition) ? doThis():doThat();
way 3: this using “while”
boolean test=condition;
while(test)
{doThis(); break;}
while(!test)
{doThat(); break;}
way 4: this using “for”
for(;condition;) { doThis(); break; }
for(;!condition;) { doThat(); break; }
way 5: this using “switch”
switch(condition) { case 0: doThat();break; default: doThis();break;}
Any other ideas?
Is there a possibility of choice execution path without a condition keyword?
This is intended to be a community wiki
You can use shortcut logic.