1 00:00:00 --> 00:00:17 The basic principle of for loops is that it will repeat a block of codes the number of times you specify, using not only a condition but also the initialization in the beginning and the increment at the end. 2 00:00:18 --> 00:00:37 So how much you want to increment your variable determines the number of times your variable loops by. 3 00:00:38 --> 00:00:42 So, it is a bit more complex to write. However it looks good , it does the job and its very compact. 4 00:00:43 --> 00:00:52 Now we write 'for' 5 00:00:53 --> 00:01:02 so you have got three parts of your code here,and your block and that is all you need and your content can go here. 6 00:01:03 --> 00:01:12 So, I am going to say 'echo' here and let's create a variable 'num'. So, we have echoed out 'num'. 7 00:01:13 --> 00:01:21 In here, we write num =1, not = = 1 because we are setting the variable num to the value of 1. 8 00:01:22 --> 00:01:30 Then we have a condition. For eg, while num < = to 10 9 00:01:31 --> 00:01:36 Then, we have the increment values. So, we are going to have num ++ and the loop is done. 10 00:01:37 --> 00:01:46 So, we type 'For', and our variable num=1 11 00:01:47 --> 00:01:51 Then we have our condition 'While num< =10, the loop will continue, and then we have num ++ 12 00:01:52 --> 00:01:54 As you can see this is much more useful than having num ++ down below . 13 00:01:55 --> 00:01:58 and we need not declare this up here. 14 00:01:59 --> 00:02:01 It can be declared inside these parentheses. 15 00:02:02 --> 00:02:06 O.K., I forgot the line-break. 16 00:02:07 --> 00:02:09 IĆ¢€™ll add a line break on to the end of this. 17 00:02:10 --> 00:02:11 Refresh. 18 00:02:12 --> 00:02:16 There you go. 19 00:02:17 --> 00:02:24 You've got your loop ten times. 20 00:02:25 --> 00:02:27 And as it has been specified in such a way it will loop only when num is less than or equal to 10. 21 00:02:28 --> 00:02:35 After that the loop will break and you may continue with the rest of the script. 22 00:02:36 --> 00:02:36 This is a bit more complex but once you learn the basics you will find it a lot easier . 23 00:02:37 --> 00:02:42 Thanks for watching.