Flow-control structures: Difference between revisions

Content added Content deleted
(sort)
(Added Java goto example.)
Line 180: Line 180:


immediately starts the next iteration of the current innermost loop
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}}==
=={{header|Perl}}==