Exercise 4 of 7 write your own for loop continues to fail


#1

Completing PHP is impossible because "create for loop from scratch" crashes for some on for seen reason. I'm not allowed to type in my code. The code displays unexpected character in line 9 expected ")" even if I close my for loop I receive a pop up error message stating that something went wrong and I should refresh my browser. When I do the exercise crashes again. Is there some way to correct this?


#2

Hi scriptwhiz83717,

It is going to be easier to help if you show us your code.


#3

Same for me - it doesnt matter what you input it just locks up and wont continue -


#4

@teraslayer90358,

Are you able to post your code?


#6

I keep getting same error message even before completing my code. Please see attached image for the error message. I'm skipping it to the next lesson though.
Thank you.


#7

That message means that your code contains an infinite loop.


#8

Yes, I made a mistake initially on the code, but corrected it. Meanwhile, the error won't go off.
Here's the code I entered before
for ($i = 10; $i < 101; $i + 10)
{
echo $i;
}
which I believe is an infinite loop, but corrected to this and still getting same error message.

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


#9

Your second example works for me. Try reloading/refreshing the web page If that doesn't work could you copy/paste all of your code so I can try it?


#10

Here is all the code:

<html>
  <head>
    <title>Solo For Loop!</title>
  </head>
  <body>
    <p>
      <?php
      // Write your for loop below!
      for($i = 10; $i < 101; $i = $i + 10) 
      ?>
    </p>
  </body>
</html>

The problem now is that the error code won't let me work on the page again. Even having corrected it, I can't save.


#11

That bit there seems to be missing from the code you posted.

I can't reproduce what you are seeing, even when I purposely create an infinite loop.

Are you able to try a different web browser just to get past this exercise?


#12

I skipped to next tutorial, having run the code on notepad++ and got accurate result. I'm now doing the while loop. The intro seem complex, so I'm sleeping off to relax my head and continue while awake. 😄

Thanks Albion.