This forum is now read-only. Please use our new forums at discuss.codecademy.com.

While Loops in PHP Forum

View Course » View Exercise

596 points
502fc2130b7a7d0002038ffa_880732145
Submitted by
John Mercer
about 4 years ago

Cannot complete do/while loop exercise

I have added the punctuation suggested in the hint but still not getting the correct result

<?php
$loopCond = false
do {
echo "The loop ran even though the condition is false." ;
} while ($loopCond)
echo "Nor the loop is done running.";
?>

I keep getting a response about whether I included a } before the while statement, which I clearly did

Also, how does one cut and paste the code directly from the screen?


5 votes

permalink

work in firefox

<?php
$loopCond = false;
do {
echo "The loop ran even though the loop condition is false.";
} while ($loopCond);
echo "Now the loop is done running.";
?>

263 points
6ea770f15e67e1a47ec17e17adcd8926?s=140&d=retro
Submitted by
zercood
about 4 years ago


0 votes

permalink

Please ignore the absence of a ; at the end of $loopCond = false

596 points
502fc2130b7a7d0002038ffa_880732145
Submitted by
John Mercer
about 4 years ago