A. You need to specify the start value and a terminating condition. For example: the loop start with $x = 3 and ends when $x is less than 10
B. They are exactly the same a while loops.
hint: google for loops vs while loops
C. On each iteration of the for loop, the indexing variable usually, $i, if always incremented by 1
D. $i++ means $i = $i + 1
1
Expert's answer
2012-05-11T08:45:40-0400
A. It's true. for($x = 3; $x<10;$x++) {}. As you can see in brackets we need to specify start value and a terminating condition. B. It's false. Please, read hint.
C. It's false too, because in third part of definition of the for loop we can define an increment anyway we like. For examle: $x+=3 or $x*=2;
Comments
Leave a comment