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

While Loops in PHP Forum

View Course » View Exercise

808 points
B007282b8fbbfc732910aa67274b8ef8?s=140&d=retro
Submitted by
cloudBlaster54579_4f1cd8faa05b7f0001
almost 2 years ago

2/7 While Loop Syntax - Problem

When I enter the code below, I keep receiving this message: Oops, try again. expected p:first-child text to be equal to The loop is running. but got The loop is running

Seems to me it's getting what it should, any idea what I'm doing incorrectly?

<!DOCTYPE html>


Your First PHP while loop!


<?php
$loopCond = true;
while ($loopCond == true){
//Echo your message that the loop is running below
echo " The loop is running.";
$loopCond = false;
}
echo "And now it's done.";
?>

Oops, try again. expected p:first-child text to be equal to The loop is running. but got The loop is running.


1 vote

permalink

Fixed it, I had echo " The loop is running" and I shouldn't have had a space between the and The.

808 points
B007282b8fbbfc732910aa67274b8ef8?s=140&d=retro
Submitted by
cloudBlaster54579_4f1cd8faa05b7f0001
almost 2 years ago

1 Comment

51c14e598c1ccc92c1006609_222499189 Amrita Khurana Matta almost 2 years ago

while ($loopCond == true){
//Echo your message that the loop is running below
echo "The loop is running.";
$loopCond = false;
}
echo "And now it's done.";
?>