Stuck in do-while


#1

Greetings
I have a typo that is making my loop run forever.
I know how to fix it but the parser is interfering.
How do I stop the php parser from running on the bad code
I have

$x=0;
do {
statements
$x++;
} while (x<6)

The while needs to have it be $x<6 but I can't get it to stop to let me.


#2

I've commented this on a few other posts and it has worked for me so have a go with this


#3

Although I get the correct out I still keep getting an error message and can't go on without going around the 6/7 as can be seen below in my code there are parentheses around the $looCond. I have reset the code refreshed the screen several times and even changed browser from Firefox to Edge. Any clue why I am getting the error? I have even changed the variable name and I still get the same message "Oops, try again. Did you put parentheses around $LoopCond?". Thanks,
Charlie

Code:






<?php
$loopCond = false;
do {
echo "

The loop ran even though the loop condition is false.

";
} while ($loopCond == true);
echo "

Now the loop is done running.

";
?>

output:
The loop ran even though the loop condition is false.

Now the loop is done running.

Error message:
Oops, try again. Did you put parentheses around $LoopCond?


#4

Really starting to believe there is an error in the code on 6/7 from codecademy the following code is accepted as correct in 7/7 but there s a error in 6/7 "

$i = 0;
do {
$i ++;
echo "

The number is: $i

";
} while ($i<5);
echo "

Made it!!!

";

#5

iam having the same rob..:frowning:


#6

i too am facing the same problem here..


#7

i am facing the same problem as people stated above.


#9

yea same... I think is their wrong.