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

For Loops in PHP Forum

View Course » View Exercise

581 points
Picture
Submitted by
Lincoln Lubrese
about 4 years ago

I've got a problem in finishing it!

Hey, Codecademy, I'm trying to finish this topic. Although I get everything done, it still says I have this 1.4 lesson remaining. I did it thousands of times. I just want my badge =(


2 votes

permalink

Were you doing it right? Try copy this if not.

Solo For Loop!



<?php
// Write your for loop below!
for ($i = 50; $i > 5; $i -= 5) {
echo $i;
}
?>

379 points
B09738f202544b1242d89eeb6a15f5d3?s=140&d=retro
Submitted by
Laampan
about 4 years ago

3 Comments

Ee26436d0c61ced645071f9807bb6e10?s=140&d=retro Trecia Arlette about 4 years ago

I copied and pasted, this worked, thanks!

564b7ea7b62548d63f0002ab_436092114 Kyle B. Johnson about 4 years ago

I copied and pasted, also, making it work.
Must be a bug in the validation.

43fc1a60ad6ce5353a8eb1ec14a01abb?s=140&d=retro Yanmeng about 4 years ago

Great!


0 votes

permalink

$i > 5;

That expression does not include 5 as it is supposed to be. You could do

$i > 4;

But it works so I guess there is a bug in here ...

787 points
E33f5964b6d682d2d2f956e69b5a7061?s=140&d=retro
Submitted by
G
about 4 years ago

1 Comment

15374e3321142c169c0f94c439d3b784?s=140&d=retro tom slick about 4 years ago

$i >= 5;
also this works


0 votes

permalink

Guess it was a bug or something. I tried everything. It was saying that everything was right, green check and all, but in the end it was like "Are you dumb? Finish that, man!"
Now it's working.
Thank you guys!

581 points
Picture
Submitted by
Lincoln Lubrese
about 4 years ago


0 votes

permalink

You don't have to actually include 5 to have it validated: put the condition to >5 and it will work.

2724 points
A5c341b058845caac1057353e99cab42?s=140&d=retro
Submitted by
Giacomo Sorbi
about 4 years ago

2 Comments

43fc1a60ad6ce5353a8eb1ec14a01abb?s=140&d=retro Yanmeng about 4 years ago

Oh,you got a lot of points!!!!

A5c341b058845caac1057353e99cab42?s=140&d=retro Giacomo Sorbi about 4 years ago

Apparently ;)