1
00:00:00,120 --> 00:00:06,030
We can use a javascript break and continue statements to either exit a loop or skipping iteration of

2
00:00:06,030 --> 00:00:07,240
a loop.

3
00:00:07,390 --> 00:00:12,590
Let's start with the break statement in this example.

4
00:00:12,650 --> 00:00:21,820
We've declared a variable I next we have a for loop that sets the initial value of Ida 0 and defines

5
00:00:22,420 --> 00:00:26,680
our loop to execute as long as I remains under 10.

6
00:00:26,740 --> 00:00:31,790
So from 0 to 9 we then have an if statement that will stop the loop.

7
00:00:31,870 --> 00:00:38,830
If the value of i it's 3 and that's what the brake statement allows us to do in our web browser we can

8
00:00:38,830 --> 00:00:41,590
confirm that the loop did stop.

9
00:00:41,590 --> 00:00:43,850
When I it's 3 you can see it.

10
00:00:43,870 --> 00:00:46,830
We only have the value 0 1 in 2 output.

11
00:00:47,320 --> 00:00:50,380
If we replace the brake statement with a continuous statement

12
00:00:54,860 --> 00:01:01,810
we can skip an iteration of the loop when the value is equal to three the loop will continue as normal

13
00:01:01,880 --> 00:01:03,800
after the skipped iteration.

14
00:01:03,980 --> 00:01:12,020
So you can see that we go to 0 1 2 3 is skipped and then the loop continues onward until until the value

15
00:01:12,020 --> 00:01:12,410
9.
