Using Endwhile -- Keeps freezing


#1

I started the loop section last night and anytime I clicked save and submit it freezes up and I have to reload the page. Here is my code. I'm 99% sure it's not an infinite loop. I even tried it without $W_coasters = false; before the endwhile line but I getting "Parse error: syntax error, unexpected $end on line 17" and freezes up the same.

I read elsewhere on the PHP Q/A board that Codecademy keeps freezing at various points of the loops lesson for other users, others say it's bugs in the PHP language, yet others say it's bugs with the course. Is it an issue with my code? PHP? or Codecademy bugs? Thank you!

<!DOCTYPE html>
<html>
    <head>
		<title>A loop of your own</title>
        <link type='text/css' rel='stylesheet' href='style.css'/>
	</head>
	<body>
    <?php
        $W_coasters = "wet";
    
        while($W_coasters):
          echo "The coasters are wet. No party tonight!";
          $W_coasters = false;
          endwhile;
    ?>
    </body>
</html>

#2

Hi try to change that $W_coasters = "wet" to that

$W_coasters = true;

#3

Solved. I waited hour or so before revisiting this exercise. It passed as written above. Thanks.


#4

use this friends

<?php
//Add while loop below
$loopCond = true;
while ($loopCond == true):
//Echo your message that the loop is running below
echo "

The loop is running.

";
$loopCond = false;
endwhile;
echo "<p>And now it's done.</p>";
?>

#5

This worked! Thank you so much.


#6

I am currently experiencing this issue. When I click save, it doesn't load.

Here is my code, but it worked on the previous exercise.

<!DOCTYPE html>
<html>
    <head>
        <title>A loop of your own</title>
        <link type='text/css' rel='stylesheet' href='style.css'/>
    </head>
    <body>
    <p> Count Up to 10 then launch..</p>
    <?php
    //Add while loop below
    $CountDown = 0;
    
    while($CountDown < 10):
        echo "$CountDown..";
        $Countdown ++;
        
    endwhile;
    
    ?>
    </body>
</html>

I tried replacing it with the code mentioned above, and it didn't seem to work.


#7

J'ai le même code que toi et moi ça fonctionne regarde




A vous de jouer avec les boucles While



<?php
//Ajoutez une boucle While ci-dessous
$compteurBoucle = 0;
while ($compteurBoucle < 10):

        echo "<p>La boucle tourne tourne...</p>";
    $compteurBoucle = 10;

echo "<p>Après le dernier tour efftectué, la boucle se termine.</p>";
endwhile;
?>
</body>