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

For Loops in PHP Forum

View Course » View Exercise

3557 points
528d3631f10c60553a00672e_831655709
Submitted by
LilBigBen
about 4 years ago

What goes wrong please?

Here is my code :

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

Here is the codecademy message :

Oops, try again! Did you set the second part of your loop correctly (the part that ends the loop)? Don't forget your semicolon!


2 votes

permalink

change it to
for ($i=50; $i>=5; $i= $i -5)

reload the page and make the changes so it doesnt hang

85 points
C512d29d775c44c3a7ba40bf02f56e8a?s=140&d=retro
Submitted by
pouyaz123
about 4 years ago

1 Comment

52b390db8c1ccc5db8000759_940907111 TheInvisabru almost 4 years ago

Or it can be
for ($i=50; $1>1; $1= $i-5)

Just a variation for you. And it worked for me.