What is the error in do while loop?


Much a do-while

$loopCond = false;
do {
echo "

The loop condition is false.

while ($loopCond == true);
	echo "<p>Now the loop is done running.</p>";

got error:expandFull Screen Save & Submit Code Reset Code Oops, try again. Did you put parentheses around $LoopCond?


Right here, you create the variable. The 'do' block is a semi complete while loop.


what it should be? can you be more specific ?


I don't personally know PHP, didn't take the course, but to me it looks like you were trying to turn the

into a while loop, and if you were then you forgot the whole "while ($loopCond == false);" part


do is not a standalone construct. It is do-while.

keyword {
    // code block
} keyword (condition);


isn't my example like that ?


Not how I remember it. Must be a blown fuse. Belay, belay.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.