Help ! I saved an infinite loop


#1

Hello,
I saved and submitted an exercise with an infinite loop...
Unfortunately, everytime I refresh the webpage, I come back to the mistake I saved and my browser crashes immediately. I can't reset the code before the browser crashes.

Any tips to fix the problem ? Thanks in advance !


#2

Haven't heard back yet whether this works, so please let us know.

  1. Return to lesson previous to the problem one.
  2. Set screen zoom high enough (perhaps even 400%) so the Preview Window disappears.
  3. Proceed back to lesson and Reset and Refresh.
  4. Restore normal screen zoom of 100%.

The lesson should be functional, now.

Because Auto-run can engage before our loop is completely typed in, we may find ourselves back in this same situation. There are two ways to go about preventing this:

1. Introduce a simple syntax error that will throw a Parse Error

<?php
    else
?>

Write your loop statement, then remove this error when ready to Submit and Save.

2. Write the loop in reverse:

control = 0;
_{
    control++;
    // other code
}

When all the code is place, add in the while () with the conditional. (_) is another deliberate error to remove AFTER writing the conditional.


#3

Hi mtf !

Thanks a lot for your help ! It worked :smiley:
With the screen zoom, I could have reset the code !

Many thanks !!


#4

Thank you so much. It helped me too!