## Break

break is an instruction that allows you to stop processing a loop (or "switch" conditional).
If you want to end a loop before its condition is false, you can use the break instruction after a conditional "if()".

Example:
```var total:int = 1;

// create a for() loop
for(var i:int=0; i<4; i++)
{
total *= 2;
if(total==8) break;         // ends completely this loop
trace('i='+ i+ ' - total='+ total);
}

// Output:  i=0 - total=2  i=1 - total=4
```
When the conditional "if(total==8)" returns true, the code after the "break" will not be executed at all, and the execution of this "for()" loop ends.
The Output panel displays:
i=0 - total=2
i=1 - total=4
- The condition (i<4) is still true, becouse the value of "i" is 1, but the "break;" instruction ends completely this loop.

## Continue

The continue instruction skips the remaining statements in the current loop and begins the next iteration at the top of the loop.
The difference between "break" and "continue" is that the "break" statement ends completely the loop, while "continue" ends the current iteration only, and lets the loop to continue with the next iteration.

Example:
```var total:int = 1;

// create a for() loop
for(var i:int=0; i<4; i++)
{
total *= 2;

// skip other actions in the current iteration when total==4 or total==8
if(total==4 || total==8) continue;

trace('i='+ i+ ' - total='+ total);
}
```
The Output is:
i=0 - total=2
i=3 - total=16
- Notice that when the value of "total" is 4 or 8, the trace() statement after the "continue" instruction is not executed, but the for() loop continue with the next iterations until its condition is false.

"break and "continue" can be used with any loop statement: while(), do..while, for(), for..in, for each..in.

#### Daily Test with Code Example

##### PHP-MySQL
What attribute makes the input text box to not be modified by the user?
`<input type="text" value="fixed-value" readonly="readonly" name="a_name" />`
What CSS property allows you to create rounded corners in your webpage design?
```.class {
border:2px solid blue;
}```
What instruction displays a confirmation dialog box to the viewer, who must then click OK or Cancel to proceed?
indexOf() confirm() prompt()
```var ques = window.confirm("The result of 0+0 is 0?");
Indicate the PHP function that returns the lowest number of the parameter values.
floor() ceil() min()
```\$min_nr = min(12, 8, 25, 13);
echo \$min_nr;        // 8```
Break and Continue

#### Last accessed pages

1. Blade Templates - Part 1 (479)
2. Disable button and Enable it after specified time (17427)
3. Laravel Basic Architecture (1224)
4. setTimeout and this with bind() method in JavaScript class (4999)
5. sPBM - Simple PHP Backup Manager (3330)

#### Popular pages this month

1. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (64)