/ Published in: JavaScript
Just some pseudo-code notes about using labels with `break` and `continue` statements.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
outer_loop: while(outer_condition) { //some statements while(inner_condition) { //some statements if(skip_the_rest_of_inner) continue; if(exit_inner_and_skip_the_rest_of_outer) continue outer_loop; if(exit_inner_loop) break; if(exit_outer_loop) break outer_loop; //statements to skip } //statements to skip } statements_block: { //some statements if(skip_remaining_statements) break statements_block; //statements to skip }