Created
May 18, 2013 14:14
-
-
Save pgainda/5604550 to your computer and use it in GitHub Desktop.
Let's say we have a loop and there's some condition that makes us want to immediately stop the loop. There's a handy statement called break that lets us do just that. It works for both for and while loops, but not for recursion. It's similar to return (which lets you end a function), but is specifically for loops only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (true) { | |
console.log("I only print once!"); | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment