Posted By

wizard04 on 09/08/08


Tagged

javascript break label continue


Versions (?)

JavaScript labels


 / Published in: JavaScript
 

Just some pseudo-code notes about using labels with break and continue statements.

  1. outer_loop:
  2. while(outer_condition)
  3. {
  4. //some statements
  5. while(inner_condition)
  6. {
  7. //some statements
  8. if(skip_the_rest_of_inner) continue;
  9. if(exit_inner_and_skip_the_rest_of_outer) continue outer_loop;
  10. if(exit_inner_loop) break;
  11. if(exit_outer_loop) break outer_loop;
  12. //statements to skip
  13. }
  14. //statements to skip
  15. }
  16.  
  17. statements_block:
  18. {
  19. //some statements
  20. if(skip_remaining_statements) break statements_block;
  21. //statements to skip
  22. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: nibbler on May 2, 2012

nice find :) +1

You need to login to post a comment.