Completing the Loop lesson in PHP


#1

I've completed the lesson but it will not allow me to move on. I keep being told to put parenthesis around my $loopCond but I have already done this.
This is my code:







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

The loop ran even though the loop condition is false.

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

?>
</body>

Is there something I am missing?


#2

Hi Michael,

Would you mind giving a link to the lesson your on, then editing your post to format the code so we can see it?
You can format code by selecting it all while in the post editor, and pressing Ctrl/Cmd + K, or by adding a new line and three backticks (`) before and after your code, like this:


```
<code> will show up properly here
```

Thanks :)


#3

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

https://www.codecademy.com/courses/web-beginner-en-5YvPF/0/6?curriculum_id=5124ef4c78d510dd89003eb8

I hope I did this right. lol. Thank you for your help in advance.


#4

And why is this in the JQuery Category :laughing:


#5

@coreplayer57207 Yes, you did it right, thanks for formatting your code :)
Your code works fine for me though, so I'd suggest refreshing the page or switching browsers.

@amanuel2 I took care of that; it was part of why I needed the exercise link :)


#6

I have the same problem. I tried both Opera and Chrome but I always get the error message


#7

@nameless_hero Do you get passed if you use Firefox?


#8

I finally passed in Opera. I just erased =false after $loopCond in the parentheses, so it was:
} while ($loopCond);
and it did the job.


#9

hi @nameless_hero thanks for the info !!! It works by updating the code as mentioned by you


#11