This forum is now read-only. Please use our new forums! Go to forums
Parse error: syntax error, unexpected T_VARIABLE, expecting '(' on line 13
Hello,
I have this code :
<?php
$loopCond = false;
do
{
echo "<p>The loop ran even though the loop condition is false.</p>";
}
while $loopCond ;
echo "<p>Now the loop is done running.</p>" ;
?>
And see this error message : Parse error: syntax error, unexpected T_VARIABLE, expecting ‘(‘ on line 13
I do not see the error I made.
Can someone help me ?
Roelof
Answer 5216230d548c3528e70036a8
0 votes
I don’t know why your indentation looks messed up there, but try this:
- Reset the code, and start again.
- Set your “while-conditions” within
( )
brackets… this is important!
And then there is a slight hiccup with the course in that while ‘true’, you have to echo
:
“The loop is running.”
Exactly as typed or it will fail
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
the echo “
The loop is running.
“; is from exercise 1.2 its seems that the doubt of roelof1967 is from exercise 1.6…… But aside the echo thing you are absolute correct, what is missing for him is the () on the while conditional.=)