Bifalgorithm post · Computer science one · Foreach Loops
How does a do-while loop differ from a while loop in PHP?
How does a do-while loop differ from a while loop in PHP? (Computer science one · Foreach Loops) — "PHP also supports do-while loops. Recall that the differenc…
Ideas in this flowchart
- Do-while loops in PHP
- The continuation condition is checked at different points in while and do-while loops.
- A while loop checks the condition before the loop body begins.
- A do-while loop checks the condition at the end of the loop.
- A do-while loop always executes at least once.
- Code Sample 39.4 demonstrates a do-while loop in PHP.
- The opening curly bracket appears on the same line as the do keyword.
- The while keyword and continuation condition appear on the same line as the closing curly bracket.
- A semicolon follows the continuation condition even though it is not an executable statement.