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

For Loops in PHP Forum

View Course » View Exercise

568 points
C59c586715fb1e37207a494bb0e45c1e?s=140&d=retro
Submitted by
seejaeger
over 4 years ago

ATTN CODECADEMY: When to Use For is asking me to count up by 10

Have been having problems with the PHP lessons the whole day so far...

Multiple refreshes to get the code to compile

Thanks


4 votes

permalink

Found this one one of the other questions. I guess you need to make the for() part
for ($i = 50; $i > 4; $i = $i -= 5)....emphasis on the third part and the $i -= 5. Not sure why it needs to be like that with the '-' but it worked for me.

348 points
65c90e1eb130d493bf00609c8a5bc64f?s=140&d=retro
Submitted by
gingeraccountant
over 4 years ago


0 votes

permalink

Same, I'm wondering if it is somehow trying to verify the previous lesson where we were supposed to do that....

I think it's just bugged

348 points
65c90e1eb130d493bf00609c8a5bc64f?s=140&d=retro
Submitted by
gingeraccountant
over 4 years ago


0 votes

permalink

Flip the sign from greater than to less than. The middle statement is setting a condition to do the for loop while the middle condition is true. That is my understanding. I had the same problem with exercise 3 as well as this exercise for the same reason.

172 points
Picture
Submitted by
Andy Schnick
over 4 years ago