1. Home
  2. Computing & Technology
  3. JavaScript

Break

By Stephen Chapman, About.com

Definition: The break statement terminates execution of a block of code earlier than normal. It either breaks out of the closest block of code if by itself or it can break out of a labelled block at a higher level by specifying the name of the block to break out of. The most common use for the break statement is within a switch block where it is used to break out of the switch block after the appropriate code for the matching case has been run. Break is a reserved word and cannot be used for anything other than declaring a break statement.
Examples:
if (a == b) break;
Explore JavaScript
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.