1 00:00:01,300 --> 00:00:05,200 Let just not proceed and take out the loop control statements in case of Cartland. 2 00:00:05,290 --> 00:00:11,240 So in Scotland we have the breeks statements Gunday new statements and also the return statements. 3 00:00:11,470 --> 00:00:15,610 Now in this video we will check out the big statements. 4 00:00:15,690 --> 00:00:22,350 So he had inserted the intelligent ID I've simply written for you such as print the values from 1 to 5 00:00:22,350 --> 00:00:22,860 10. 6 00:00:22,860 --> 00:00:27,170 So let us not execute our code so the output console. 7 00:00:27,210 --> 00:00:30,420 We have the output from 1 to 10. 8 00:00:30,420 --> 00:00:32,540 Now suppose I want to print the value. 9 00:00:32,590 --> 00:00:34,020 Well let's see five. 10 00:00:34,110 --> 00:00:36,970 I don't want to print the values after 5. 11 00:00:36,990 --> 00:00:39,300 That is 6 7 8 9 10. 12 00:00:39,300 --> 00:00:42,140 So far that I will simply write a condition. 13 00:00:42,150 --> 00:00:46,600 Let's see if after printing 5 let's just write the condition. 14 00:00:46,710 --> 00:00:53,840 If large eye is equal to equal to 5 then I would simply break out of the loop. 15 00:00:53,840 --> 00:00:54,290 Right. 16 00:00:54,450 --> 00:01:01,160 So I will simply use the break key word here and now let us in our code and let's do the output. 17 00:01:01,230 --> 00:01:05,030 So in the output we have 1 2 3 4 and 5. 18 00:01:05,040 --> 00:01:08,150 So with the help of break statement then it becomes 5. 19 00:01:08,220 --> 00:01:15,440 We simply exit out of this loop that is we no longer represent the values after the i becomes 5. 20 00:01:15,690 --> 00:01:20,310 So this is the main purpose of using the break statement in Cartland. 21 00:01:20,310 --> 00:01:27,390 Now suppose if I remove the if condition from here and suppose if I have the multiple loop that is for 22 00:01:27,390 --> 00:01:30,530 loop within which I have one more for you. 23 00:01:30,930 --> 00:01:33,030 So let's use g in. 24 00:01:33,090 --> 00:01:35,530 Let's see if one door Dorton now. 25 00:01:35,580 --> 00:01:36,390 Insert this. 26 00:01:36,390 --> 00:01:43,950 Suppose I print the values third sprint the value using the interpellation dollar i.e. Then space then 27 00:01:43,960 --> 00:01:45,070 dollar G. 28 00:01:45,390 --> 00:01:49,440 And now US and the cold and let's LHC the output. 29 00:01:49,440 --> 00:01:53,550 So here we are getting too much of output in the output console. 30 00:01:53,550 --> 00:01:54,720 So it does do one thing. 31 00:01:54,720 --> 00:01:56,250 Let us reduce the range. 32 00:01:56,250 --> 00:01:58,220 Let's see one two three. 33 00:01:58,380 --> 00:02:01,200 And then again one two three. 34 00:02:01,440 --> 00:02:06,070 And then the called. 35 00:02:06,230 --> 00:02:11,400 So in the output I have 1 1 1 2 1 3 2 1 and so on. 36 00:02:11,530 --> 00:02:12,110 37 3:3. 38 00:02:12,230 --> 00:02:18,260 So all the combinations we're having in the output console that we can have with the numbers of 1 2 39 00:02:18,260 --> 00:02:18,850 and 3. 40 00:02:18,950 --> 00:02:27,440 And now suppose if I have to break off this to do that is I don't want to put in 2 3 3 1 3 2 and 3 3. 41 00:02:27,530 --> 00:02:30,140 So I going to print the output then to do. 42 00:02:30,230 --> 00:02:35,250 So what I will do is soon after this print in statement I will simply use. 43 00:02:35,460 --> 00:02:45,680 If let's say I equal two equal to 2 and G equal to equal to 2 then I was simply trying to break out 44 00:02:45,680 --> 00:02:46,450 of the loop. 45 00:02:46,580 --> 00:02:51,520 So that is the break condition and then let us note in the chord. 46 00:02:51,710 --> 00:03:00,170 Now here if you notice what is happening here we are getting 1 1 1 2 1 3 2 1 2 2 and after 2 2 we are 47 00:03:00,230 --> 00:03:04,000 again getting reinterred 3 1 3 2 and 3 3. 48 00:03:04,010 --> 00:03:09,710 Now the break statement Bideford simply breaks out of the nearest loop. 49 00:03:09,710 --> 00:03:15,960 Now the nearest fit into loop within which this break is present is actually this for loop right. 50 00:03:15,990 --> 00:03:17,550 That is the inner for loop. 51 00:03:17,570 --> 00:03:21,560 Now the outer for loop remains unaffected with this break. 52 00:03:21,560 --> 00:03:27,280 So in that case here we have one more concept of let's say liberi for loop. 53 00:03:27,440 --> 00:03:32,630 So here I will simply use my new added space. 54 00:03:32,630 --> 00:03:36,830 Now we have simply assigned a name for the outer for loop that is. 55 00:03:36,830 --> 00:03:39,190 This loop is now known as my loop. 56 00:03:39,200 --> 00:03:44,760 Now I have to tell the break statement that you have to break out of this outer for. 57 00:03:44,950 --> 00:03:46,340 Know the inner for loop. 58 00:03:46,490 --> 00:03:51,380 So for that I will simply use brigge at the read my loop. 59 00:03:51,440 --> 00:03:58,400 So this Briggs statement will now break out of this outer for loop and border loops in return will be 60 00:03:58,400 --> 00:04:00,520 terminated automatically. 61 00:04:00,530 --> 00:04:02,660 So let us note in the chord. 62 00:04:02,780 --> 00:04:06,720 So here we go in the output we have just to do at the end. 63 00:04:06,800 --> 00:04:13,150 So after the condition is met after two or two we don't have any output in the output console. 64 00:04:13,190 --> 00:04:19,030 So in this video you have just now learned a new concept of the labeled for loop right. 65 00:04:19,070 --> 00:04:23,470 How we can use the label and big huge advantage. 66 00:04:23,510 --> 00:04:27,530 So this is all about this video about the break statement in Cartland.