1 00:00:01,390 --> 00:00:02,700 Hi There's a sharings at the heart. 2 00:00:02,720 --> 00:00:06,300 And welcome to the next video of this girdling programming series. 3 00:00:06,380 --> 00:00:10,560 Now this is where they move video for the for loop like loop and Dubai. 4 00:00:10,700 --> 00:00:11,650 So check it out. 5 00:00:11,660 --> 00:00:18,410 Inside the intelligence the so here inside the indelible I.D. within the mean function. 6 00:00:18,410 --> 00:00:21,200 Let us try first though for you. 7 00:00:21,470 --> 00:00:29,290 So in case of follow the syntax is for followed by a space Blackard open and close inside this I would 8 00:00:29,290 --> 00:00:36,490 simply use the variable of i followed by an operator followed by let's see where does he find the range. 9 00:00:36,490 --> 00:00:40,090 Let's see one dot dot then right. 10 00:00:40,300 --> 00:00:42,100 And now inside the forward Lou. 11 00:00:42,220 --> 00:00:48,700 I would simply use the printed statement label the event line and simply print the value of I that range 12 00:00:48,700 --> 00:00:50,010 from 1 to 10. 13 00:00:50,020 --> 00:00:54,080 Now this is the range that I have used here and the concept of range. 14 00:00:54,130 --> 00:00:56,800 I have already discussed in the previous videos. 15 00:00:56,830 --> 00:00:58,140 So please check that out. 16 00:00:58,360 --> 00:01:00,530 And now let us put in the code. 17 00:01:00,910 --> 00:01:01,770 So here we go. 18 00:01:01,780 --> 00:01:04,590 1 2 3 4 5 6 7 8 9 10. 19 00:01:04,620 --> 00:01:07,690 We are simply printing the values from 1 to 10. 20 00:01:07,690 --> 00:01:13,630 Now suppose if I ask you to write a program using the for loop to print out all the even numbers starting 21 00:01:13,630 --> 00:01:15,100 from 1 to 10. 22 00:01:15,100 --> 00:01:16,080 Now insert this. 23 00:01:16,090 --> 00:01:25,720 I will simply read if it's condition such as if I mark doorless Legacy 2 is equal to equal to zero. 24 00:01:25,830 --> 00:01:29,040 Then simply print out the value of i right. 25 00:01:29,070 --> 00:01:31,200 So let us now add in the code. 26 00:01:31,200 --> 00:01:32,150 So here we go. 27 00:01:32,190 --> 00:01:34,290 Two four six eight and 10. 28 00:01:34,290 --> 00:01:39,270 So here we have five even numbers starting from 1 to 10. 29 00:01:39,270 --> 00:01:41,240 Deadfalls between 1 to 10. 30 00:01:41,320 --> 00:01:46,310 Right now this was all about the for loop in case of Cartland. 31 00:01:46,330 --> 00:01:49,930 Now if you are a beginner then you must continue watching this video. 32 00:01:50,050 --> 00:01:53,170 And if you already know Java and you already know. 33 00:01:53,230 --> 00:01:59,260 How does a for loop works then simply jump on to the next video don't voice this video just save your 34 00:01:59,260 --> 00:01:59,760 time. 35 00:01:59,810 --> 00:02:01,390 Right so all the beginners. 36 00:02:01,390 --> 00:02:03,190 Please continue with this video. 37 00:02:03,280 --> 00:02:06,410 So how does a for loop in case of Cartland works. 38 00:02:06,430 --> 00:02:12,020 Now the for loop has the initializer the operator and then redefined the range. 39 00:02:12,280 --> 00:02:14,410 And then we put our record here. 40 00:02:14,590 --> 00:02:16,370 Now let us take some example here. 41 00:02:16,390 --> 00:02:21,500 On the left hand side suppose I have 4 in a range of 1 to 3. 42 00:02:21,700 --> 00:02:23,880 And then here I simply print hello. 43 00:02:23,970 --> 00:02:24,450 Right. 44 00:02:24,610 --> 00:02:28,780 So what happens exactly when these three lines of chords are executed. 45 00:02:28,780 --> 00:02:31,190 What happens is that in the output we will get. 46 00:02:31,210 --> 00:02:31,630 Hello. 47 00:02:31,660 --> 00:02:33,750 Hello and hello three times. 48 00:02:34,060 --> 00:02:39,440 Now this simply shows that the print line method has been executed three times. 49 00:02:39,460 --> 00:02:44,140 That is loop when loop through and loop 3 has been executed. 50 00:02:44,160 --> 00:02:47,650 Now after the loop the loop actually terminates. 51 00:02:47,680 --> 00:02:53,890 Right and now here I have simply to find some columns initialize or Nishan chick Gord. 52 00:02:53,940 --> 00:02:55,030 An angry man. 53 00:02:55,030 --> 00:03:00,310 So this is the law for the for loop right now in the first loop is actually executed. 54 00:03:00,400 --> 00:03:04,430 The value of i is actually open and Next comes the condition check. 55 00:03:04,510 --> 00:03:07,380 So the info is inside this fringe right. 56 00:03:07,420 --> 00:03:08,450 One two three. 57 00:03:08,470 --> 00:03:10,470 So the condition becomes true right. 58 00:03:10,630 --> 00:03:14,390 And then we simply print hello with the help of this statement. 59 00:03:14,530 --> 00:03:20,320 And finally at the end of the loop we simply increment the value of an internally and now the value 60 00:03:20,320 --> 00:03:28,930 of IB comes to right and this value of 2 comes at the very initial point of the second. 61 00:03:29,050 --> 00:03:35,110 So in case of second loop again we have the condition check to actually falls inside this range so the 62 00:03:35,110 --> 00:03:42,070 condition becomes true again and again we print hello and finally Are the end of loop do we simply increment 63 00:03:42,070 --> 00:03:44,900 the value of pi and it becomes three. 64 00:03:45,220 --> 00:03:47,050 And now this is equal to 3. 65 00:03:47,050 --> 00:03:53,830 Now again comes the initial point of all you can say the starting point of loop 3 and again the condition 66 00:03:53,830 --> 00:04:00,000 becomes true because this tree is actually present inside the range of 1 to 3. 67 00:04:00,250 --> 00:04:01,950 So again we print hello. 68 00:04:02,110 --> 00:04:04,880 And finally the value of IB comes forward. 69 00:04:05,140 --> 00:04:07,230 Now at the end of loop 3. 70 00:04:07,300 --> 00:04:14,710 When the value of it becomes for this food right to initiate the food loop which never happens because 71 00:04:14,980 --> 00:04:19,890 this is equal to food simply makes the condition as follows. 72 00:04:19,930 --> 00:04:23,070 Because the food does not lie inside the range. 73 00:04:23,260 --> 00:04:26,150 And finally the loop that we need is right. 74 00:04:26,170 --> 00:04:32,070 So this is how the for loop but it's the whole flue of the for loop is in front of you. 75 00:04:32,080 --> 00:04:33,990 You can again watch this video. 76 00:04:34,090 --> 00:04:38,270 If you are a beginner right and then only proceed with the next video.