1 00:00:00,090 --> 00:00:07,590 Let us not discuss about the continue statement the break and the continue statement. 2 00:00:07,720 --> 00:00:15,560 I used to alter the flow of a new break terminate the loop when a condition is met. 3 00:00:16,150 --> 00:00:26,110 Whereas continue skips the current iteration so let understand how a continuous statement can be used 4 00:00:26,200 --> 00:00:29,020 in a for loop using an example. 5 00:00:29,500 --> 00:00:31,530 So consider this example. 6 00:00:31,660 --> 00:00:39,110 We have a list B which contained positive and negative numbers and 2. 7 00:00:39,130 --> 00:00:41,000 I did it through this list. 8 00:00:41,110 --> 00:00:51,850 We are using of all the body of the for loop contains the if clause and the if clause checks if any 9 00:00:51,850 --> 00:00:55,000 of the items is a negative number. 10 00:00:55,570 --> 00:01:03,910 If the item is a negative number it does not perform any action on the item IDs. 11 00:01:03,940 --> 00:01:08,450 That means if x is greater than or equal to zero. 12 00:01:08,620 --> 00:01:18,900 In that case we square this number and then print the number so let us execute this piece of code in 13 00:01:18,900 --> 00:01:21,020 Jupiter notebook. 14 00:01:21,060 --> 00:01:25,880 So this is the code that we we're going to execute. 15 00:01:25,920 --> 00:01:33,940 If the number or the item in the list B is negative then we do not perform any action. 16 00:01:33,960 --> 00:01:37,500 We use continue statement the continual statement. 17 00:01:37,500 --> 00:01:48,460 Let us keep doing any action on the item in the list because it does make a condition and it allows 18 00:01:48,460 --> 00:01:54,040 the program to go to the next iteration of the next item in the loop. 19 00:01:54,670 --> 00:01:57,760 So let execute this piece of code. 20 00:01:58,120 --> 00:02:06,630 So as you can see the items which are less than zero are not square. 21 00:02:07,720 --> 00:02:13,680 Only the items which are greater than or equal to zero add squared. 22 00:02:13,900 --> 00:02:23,320 So with the continuous statement when me either through a list using your part statement and we have 23 00:02:23,320 --> 00:02:29,900 put a condition to check if any item in the list is less than zero. 24 00:02:30,730 --> 00:02:40,540 So when we use the continue statement because 3 is greater than 0 it is in the square this number and 25 00:02:40,540 --> 00:02:43,950 this is the output it's going to square to. 26 00:02:44,050 --> 00:02:50,100 This is the output and then minus one is less than zero. 27 00:02:50,210 --> 00:02:56,360 So it keeps this particular iteration and then goes to zero. 28 00:02:56,630 --> 00:03:01,550 And the this is the output Zero One is a positive number. 29 00:03:01,550 --> 00:03:03,980 So it squares this item. 30 00:03:03,980 --> 00:03:10,100 This is the output and then it goes to 4 5. 31 00:03:10,220 --> 00:03:18,350 So using the continue statement if a condition is made we can skip the statement and the body of the 32 00:03:18,350 --> 00:03:24,970 loop for the current iteration and jump to the beginning of the loop for the next time duration if we 33 00:03:24,970 --> 00:03:28,890 use a break statement in the for loop. 34 00:03:28,980 --> 00:03:31,090 Let's see how the output looks like. 35 00:03:31,090 --> 00:03:33,340 This is the list B. 36 00:03:33,370 --> 00:03:39,430 These are the items in the list B we have used a condition to check if any item in the list is less 37 00:03:39,430 --> 00:03:40,510 than zero. 38 00:03:40,510 --> 00:03:46,960 So when we use the break statement the loop goes to the first item in the list. 39 00:03:46,970 --> 00:03:50,330 Squares this number because this is greater than zero. 40 00:03:50,500 --> 00:03:53,550 Next it goes to the second item squared. 41 00:03:53,550 --> 00:03:56,460 This number when it comes to minus one. 42 00:03:56,460 --> 00:04:04,660 This is less than zero the Briggs statement prematurely terminated the loop. 43 00:04:04,660 --> 00:04:07,970 So it does not go to the next item. 44 00:04:08,050 --> 00:04:10,280 It comes out of the for loop. 45 00:04:10,360 --> 00:04:17,170 So this is the difference between the continue statement and daybreak statement. 46 00:04:17,170 --> 00:04:23,860 Next as the parse statement the past statement does nothing. 47 00:04:23,920 --> 00:04:33,310 It can be used when a statement is required syntactically but the program requires no action the past 48 00:04:33,310 --> 00:04:36,030 statement acts as a placeholder. 49 00:04:36,400 --> 00:04:44,800 And it is usually used when there is no need of code but the statement is still required to make a code 50 00:04:44,890 --> 00:04:53,580 syntactically correct so let's see an example so consider an example here. 51 00:04:54,130 --> 00:05:07,650 So I have an if a live else statement here and the if clause checks if the use it has input white. 52 00:05:07,690 --> 00:05:12,370 In that case it it prints out this character next. 53 00:05:12,610 --> 00:05:20,230 The left clause checks if the user has input in that case it prints this correct coming to the else 54 00:05:20,230 --> 00:05:30,220 clause if the user inputs any other character apart from Y or N or if he does not input anything within 55 00:05:30,220 --> 00:05:39,570 a specified time I have used a pass statement which does nothing but makes decode syntactically correct. 56 00:05:39,580 --> 00:05:44,710 We can not leave the body of the else clause empty. 57 00:05:44,710 --> 00:05:54,750 So we are going to use a parse statement here and this brings us to love the topic loop control statement. 58 00:05:54,760 --> 00:05:55,410 Break. 59 00:05:55,440 --> 00:05:57,370 Continue and pass.