In this lesson we'll explore the four and for each.
Before loop is used when you know in advance how many times you want the code block to execute the syntax
of the p p for loop consists of three parameters as displayed in the dialog box
in this example.
We've created a for loop to output the value of variable X starting from zero and up to a value equal
to or less than 10 in our web browser.
We can see the output zero right up to 10
before each loop works only on arrays it's used to look through each key or value pair in an array.
In this example we've created an array variable cars and assigned it for values.
Volvo BMW under import.
We then set up a for each loop to loop through each value in the car's array and output the result using
the echo statement
we can see in the web browser that each value in the array has been output.
Volvo BMW Honda import
we can see that for every loop iteration the value of the current array element is assigned to the Variable
value.