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

For Loops in PHP Forum

View Course » View Exercise

955 points
51632980cba3f5c989000a2e_892706185
Submitted by
dimaseg
over 4 years ago

like in 1.3 ex., correct code can't pass

for ($i = 50; $i >= 5; $i-=5) {
echo $i;
}
code seems to ok, but :
Oops, try again.
Did you set the third part of your loop correctly (the part that counts up by 10s)? Make sure NOT to end this bit with a semicolon! (You only need semicolons for separating values.)


2 votes

permalink

it passed like in 40 minutes
the patience indeed

955 points
51632980cba3f5c989000a2e_892706185
Submitted by
dimaseg
over 4 years ago

1 Comment

515aebc769200fa815001b4d_442020788 Istvan Nonn over 4 years ago

Tip: Save your code and refresh your page


2 votes

permalink

If the instructions/hint tells us to use $i = $i + 10 or $i = i$ - 5 it should work. Some people who are new to programming might not know that += or -= work the same way. These kinds of errors are really frustrating and can confuse some beginners and cause them to quit or think they're doing it wrong. Might want to make sure that the solution suggested in the instructions is passable instead of there just to take up space. Just saying.

879 points
311de6f470efd44ce01d82f50ce7583c?s=140&d=retro
Submitted by
Michael Harring
over 4 years ago


1 vote

permalink

putting $i -= 5 instead of $i = $i - 5 worked for me, even though both gave the same answer and showed up on screen.

1390 points
Fde51cc8de5dc4538dc4b84b9d438d7a?s=140&d=retro
Submitted by
Howzlife
over 4 years ago


0 votes

permalink

same problem,can't pass this exercise.saving and refreshing didn't work..

522 points
5149d08ab62c4f245e002d6a_475950185
Submitted by
Zhao Peng
over 4 years ago