This commit is contained in:
Brent Guffens 2018-01-18 16:55:28 +01:00 committed by GitHub
parent 3159e93baf
commit 3fbe7e08c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -229,7 +229,7 @@ while (true) {
alert( 'Sum: ' + sum );
```
The `break` directive is activated in the line `(*)` if the user enters an empty line or cancels the input. It stops the loop immediately, passing the control to the first line after the loop. Namely, `alert`.
The `break` directive is activated at the line `(*)` if the user enters an empty line or cancels the input. It stops the loop immediately, passing the control to the first line after the loop. Namely, `alert`.
The combination "infinite loop + `break` as needed" is great for situations when the condition must be checked not in the beginning/end of the loop, but in the middle, or even in several places of the body.