April 21, 2009

0 JavaScript Break and Continue

There are two special statements that can be used inside loops: break and continue.

The break command will break the loop and continue executing the code that follows after the loop (if any)


<script type="text/javascript">
var i=0
for ( i=0; i<=10; i++)
if ( i==3 ) {break}
document.write ("The number is " + i )
document.write (" <br />")


Post a Comment

Blogger Themes

Powered by Blogger