Jump to content

Flow-control structures: Difference between revisions

Added Java goto example.
(sort)
(Added Java goto example.)
Line 180:
 
immediately starts the next iteration of the current innermost loop
 
=={{header|Java}}==
===goto===
Goto's are generally disliked, but they're still in the language so you can use them if you want.
public static void main(String[] args){
inputStuff();
if(someStaticVariable == someSpecialValue){
goto skip;
}
//this code is skipped
someOtherMethod(anotherVariable);
crazyAlgorithm();
skip:
//this code is never skipped
finish();
System.out.println("YOU WIN!");
}
 
=={{header|Perl}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.