Loops
Loops are repetition of the same code several times. Loops are needed to simplify code. Even so it is possible to repeat the same code several times, it is probably not a good idea.
Code will be executed inside of a loop until the loop's condition is true.
It is possible to perform execution of the code inside of a loop before the loop's check is performed, or after that check is performed. This is functionality of PHP, this functionality cannot be blindly be applied to other programming languages, as implementation of a loop functionality may differ.
Inside of a loop it is needed to adjust the value of a variable that is included in the check. Typically this variable is adjusted by one. By doing so it is possible to tell how many iteration of this loop will be.
If a variable that is included in a loop check is not adjusted, then this loop can perform executions over and over again. It is known as indefinite loop.
Comments
Post a Comment