Infinite Loop bug #3


#1

Like others, I scripted it incorrectly which set off an infinite loop. This caused the "Something went wrong :frowning:

Click Close to try again or refresh the page." pop up.

The problem is that my previous script is stored server-side and is repopulated back into the field after the refresh...which causes the exact same error to occur. The infinite Loop error causes a different type of infinite loop error.

I am going to continue on, but this error was rather annoying and despite others reporting the same error nobody posted a resolution for it....


#2

I fixed this by using a different browser to insert proper script. I like cookies, but prefer cake.


#3

can you show us your code?


#4

The issue was that Firefox's cookie storage saved an incorrect script I wrote that caused an infinite loop. After refreshing, the incorrect script was recalled from the cookies and then processed it again, yielding another infinite loop.

I fixed it by using Chrome to supply the right script, bypassing firefox's stored cookies.

for ($i = 10; $i < 101; $i + 10) {
echo $i;


#5

Guys,
Just type the code without the 'for' keyword first.

($i=10;$i<=100;$i=$i + 10) {
echo $i;
}

Finally, add the 'for' keyword.

for($i=10;$i<=100;$i=$i + 10) {
echo $i;
}

This prevents the compiler from running for loop before we finish and giving us the error


Impossible to learn with the permanent bug! HELP
#6

Here is my code witch is works fine! :smile:
I hope you see your mistakes

<?php
for($years= 2015; $years < 2050; $years = $years+ 1)
{

echo "<br> $years<br/ >";

}
?>


#7

I experienced this problem too, but I never had an infinite loop in the first place. Like @ircyborg it worked after I did the lesson from Google Chrome, but I don't understand exactly why. The first thing I tried after seeing the problem was deleting all Codecademy cookies and clearing the cache in Firefox.

My code was like this:

for ($i = 10; $i < 110; $i = $i + 10) {
echo $i;
}

When I clicked "Save & Submit Code", the text of the submit button disappeared but the button's blue rectangle was still there. I waited a long time, but finally gave up and refreshed the page. That's the first time I saw the code with the infinite loop. It looks like it saved something while I was still typing and tried to execute that.

After the refresh, I got the error message "The program took too long to finish. Check your code for infinite loops and try again." When I closed the error, I saw this code:

for ($i = 10; $i < 110; )

Some screenshots: https://flic.kr/s/aHskpyCL3p

There must be something going on besides cache and cookies. Maybe Codecademy is using HTML5 local storage?

This seems like a Codecademy bug to me, not a problem with Firefox.


#8

God! Thank you so much.


#9

it is works for me
<?php
for($years= 0; $years < 101; $years = $years+ 10)
{

echo "
$years
";
}
?>


#10

Thanks dear I fix my problem by ur suggestion.