Bug Issue


#1

This is really frustrating each time I try to submit the code and it says that there's an error in the program and you should try refreshing webpage. I kept refreshing the page and it still doesn't work. Here's my code:

<!DOCTYPE html>
<html>
    <head>
		<title>Your own do-while</title>
        <link type='text/css' rel='stylesheet' href='style.css'/>
	</head>
	<body>
    <?php
        $loopCond = true;
        //write your do-while loop below
        do {
           echo "<p>The loop is running</p>"; 
        }while ($loopCond == true); {
            echo "<p>The loop stops running.</p>";
            $loopCond = false;
        }
    ?>
    </body>
</html>

Does anyone has the same issue? Hope codeacademy fix this bug issue!


#3

I had the same problem.

My code:
<!DOCTYPE html>
<html>
<head>
<title>Much a do-while</title>
</head>
<body>
<?php
do {
echo "<p>The loop ran even though the loop condition is false.</p>";
$loopCond = false;
}
while ($loopCond);
echo "<p>Now the loop is done running.</p>";
?>
</body>
</html>


#4

Codecademy has no plans to update the course in the foreseeable future, sorry!


#5

But my code is correct. I've tried it in WebServ and it's okay.
Why did the Codecademy app veryfing it so long and not finish?


#6

I have no idea, but if it doesn't work now, and your code is correct, then it probably wont work ever.

I started the PHP course a while ago, and gave up because it's broken.


#7

this is not a bug your code has an infinite loop. the correct syntax for the do/while is

do{
    //something
}while(some_condition_is_true);

#8

yours is not necessarily an error. try defining $loopCond before using it


#9

Thanks a lot. It works!


#10

@rydan
Thanks for your advice, it worked! Next time I should check my code more carefully!:wink:


#11

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

The loop ran even though the loop condition is false.

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

I get an error when I try to submit, asking if i put parentheses $loopCond.


#12

@professorpi3.14
You are generating an infinite loop. In your do loop, after echoing The loop ran even though the loop condition is false set $loopCond variable to true.


#13

But didn't I already do that? After the do loop, I have while ($loopCond == true);


#14

@professorpi3.14

== operator is a comparison sign contrarily to = which is assigning a value. What you put in the while loop's parentheses is a condition which either evaluates to true or false, while comparing two values. You need to assign it in your do loop, not in the while.