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

While Loops in PHP Forum

View Course » View Exercise

1399 points
58ff39af9ad7f511ec000379_868316874
Submitted by
Oleg
over 4 years ago

add a semicolon

<?php
$loopCond = false;
do {
echo "The loop ran even though the loop condition is false.";
} while ($loopCond);
echo "Now the loop is done running.";
?>
Error: Oops, try again! Did you add a semicolon after the echoed string?

The result is:

The loop ran even though the loop condition is false.
Now the loop is done running.

Help plz :(


2 votes

permalink

Sounds right, you should try refreshing. The site has been weird lately. Sorry I don't have a more substantial answer, that's all I can think of. Your code seems right to me, but maybe I'm also missing something.

483 points
932d4a42534358e113107a930b4a5d86?s=140&d=retro
Submitted by
MrDrooogs
over 4 years ago

2 Comments

58ff39af9ad7f511ec000379_868316874 Oleg over 4 years ago

thanks ;)

58ff39af9ad7f511ec000379_868316874 Oleg over 4 years ago

Hurray! "Reset code" does wonders :)))


0 votes

permalink

<!DOCTYPE html>


Much a do-while


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

559 points
512d77b300facd6e300046e9_653959519
Submitted by
Salvador Rojas
over 4 years ago

1 Comment

51783fa44783abd3b8000267_165551097 Sarah B about 4 years ago

This code is incorrect, read calm the instructions on the errors.


0 votes

permalink

May I know why you eliminated these and <\p> tags ??? because in last exercise we have echo ed the statements with and <\p> tags. plz help me !

282 points
59467d81729180e0c000d42c6f5c2b00?s=140&d=retro
Submitted by
Raghul
about 4 years ago

1 Comment

5148e036c99dc4f64a000908_944110612 Phillip Gimmi almost 4 years ago

keep the tags, having them makes it look neater and not all together p= paragraph