Difference between revisions of "PHP-and-MySQL/C2/Loops-For-Statement/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(2 intermediate revisions by one other user not shown)
Line 4: Line 4:
 
|-
 
|-
 
|00:00
 
|00:00
| 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.  
+
| The basic principle of '''for''' loops is that it will repeat a '''block''' of '''code''' the number of times you specify, using not only a '''condition''' but also the  initialization in the beginning and the '''increment''' at the end.  
 
|-
 
|-
 
|00:18
 
|00:18
| So how much you want to increment your variable determines the number of times your variable loops by.  
+
| So, how much you want to increment your variable determines the number of times your variable loops by.  
 
|-
 
|-
 
|00:38
 
|00:38
|So, it is a bit more complex to write.  However it looks good , it does the job and its very compact.
+
|So, it is a bit more complex to write.  However, it looks good; it does the job and it's very compact.
 
|-
 
|-
 
|00:43
 
|00:43
|Now we write 'for'
+
|Now we write '''for'''.
 
|-
 
|-
 
|00:53
 
|00:53
|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.
+
|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.
 
|-
 
|-
 
|01:03
 
|01:03
|So, I am going to say 'echo' here and let's create a variable 'num'.  So, we have echoed out 'num'.
+
|So, I am going to say '''echo''' here and let us create a variable '$num'.  So, we have echoed out '''num'''.
 
|-
 
|-
 
|01:13
 
|01:13
|In here, we write num =1, not = = 1 because we are setting the variable num to the value of 1.
+
|In here, we write '''$num =1''', not '= = 1' because we are setting the variable 'num' to the value of 1.
 
|-
 
|-
 
|01:22
 
|01:22
|Then we have a condition.  For eg, while num < = to 10
+
|Then we have a '''condition'''.  For eg, while '''$num <= 10'''.
 
|-
 
|-
 
|01:31
 
|01:31
|Then, we have the increment values.  So, we are going to have num ++ and the loop is done.
+
|Then, we have the '''increment''' values.  So, we are going to have '''num ++''' and the '''loop''' is done.
 
|-
 
|-
 
|01:37
 
|01:37
|So, we type 'For', and our variable num=1
+
|So, we type '''for''' and our variable '''$num=1'''.
 
|-
 
|-
 
|01:47
 
|01:47
|Then we have our condition  'While num< =10, the loop will continue, and then we have num ++
+
|Then we have our '''condition''': while '''$num''' is less than or equal to (<=) 10, the '''loop''' will continue and then we have '''num ++'''.
 
|-
 
|-
 
|01:52
 
|01:52
|As you can see this is much more useful than having num ++ down below .
+
|As you can see, this is much more useful than having '''num ++''' down below  
 
|-
 
|-
 
|01:55
 
|01:55
Line 43: Line 43:
 
|-
 
|-
 
|01:59
 
|01:59
|It can be declared inside these parentheses.  
+
|It can also be declared inside these parentheses.  
 
|-
 
|-
 
|02:02
 
|02:02
|O.K., I forgot the line-break.
+
|O.K., I forgot the '''line-break'''.
 
|-
 
|-
 
|02:07
 
|02:07
|I’ll add a line break on to the end of this.
+
|I’ll just add the line-break to the end of this.
 
|-
 
|-
 
|02:10
 
|02:10
|Refresh.
+
|'''Refresh'''.
 
|-
 
|-
 
|02:12
 
|02:12
|There you go.   
+
|And there you go.   
 
|-
 
|-
 
|02:17
 
|02:17
|You've got your loop ten times.
+
|You have your '''loop''' ten times.
 
|-
 
|-
 
|02:25
 
|02:25
|And as it has been specified in such a way it will loop only when num is less than or equal to 10.
+
|And, as it has been specified in such a way, it will loop only when 'num' is less than or equal to 10.
 
|-
 
|-
 
|02:28
 
|02:28
Line 67: Line 67:
 
|-
 
|-
 
|02:36
 
|02:36
|This is a bit more complex but once you learn the basics you will find it a lot easier .
+
|This is a bit more complex but once you learn the basics you will find it a lot easier .Thanks for watching.
|-
+
|02:37
+
| Thanks for watching.
+

Latest revision as of 15:25, 24 March 2017

Time Narration
00:00 The basic principle of for loops is that it will repeat a block of code the number of times you specify, using not only a condition but also the initialization in the beginning and the increment at the end.
00:18 So, how much you want to increment your variable determines the number of times your variable loops by.
00:38 So, it is a bit more complex to write. However, it looks good; it does the job and it's very compact.
00:43 Now we write for.
00:53 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.
01:03 So, I am going to say echo here and let us create a variable '$num'. So, we have echoed out num.
01:13 In here, we write $num =1, not '= = 1' because we are setting the variable 'num' to the value of 1.
01:22 Then we have a condition. For eg, while $num <= 10.
01:31 Then, we have the increment values. So, we are going to have num ++ and the loop is done.
01:37 So, we type for and our variable $num=1.
01:47 Then we have our condition: while $num is less than or equal to (<=) 10, the loop will continue and then we have num ++.
01:52 As you can see, this is much more useful than having num ++ down below
01:55 and we need not declare this up here.
01:59 It can also be declared inside these parentheses.
02:02 O.K., I forgot the line-break.
02:07 I’ll just add the line-break to the end of this.
02:10 Refresh.
02:12 And there you go.
02:17 You have your loop ten times.
02:25 And, as it has been specified in such a way, it will loop only when 'num' is less than or equal to 10.
02:28 After that the loop will break and you may continue with the rest of the script.
02:36 This is a bit more complex but once you learn the basics you will find it a lot easier .Thanks for watching.

Contributors and Content Editors

Minal, PoojaMoolya, Pratik kamble, Sandhya.np14