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

While Loops in PHP Forum

View Course » View Exercise

1502 points
50ff5ff6b259c6aae300039b_362085933
Submitted by
Bill Hinostroza
over 3 years ago

4/7 Parse error: syntax error, unexpected '<'

I get an error message but I still pass?

Here is my code

<?php
        //Add while loop below
        $num1 = 0;
        while($num1 =< 10):
            echo  $num1 . " <br/>";
            $num1 ++;
        endwhile;
?>

and here is the error

Parse error: syntax error, unexpected
'<' on line 11 >

What gives?


2 votes

permalink

Your while statement should be while($num1 <= 10): the '<' goes before the '='.

168 points
52bca3d0548c352599000249_274361146
Submitted by
Dannie Scull
over 3 years ago