I don't understand my syntax error!



Apparently there is a syntax error, but I can't find it.
Error messages:
"Oops, try again. There was a problem with your syntax."
"SyntaxError: Unexpected token {"
Please Help me find the syntax error. Thank you

var soloLoop = function(){
    // ^Declaring the loop function
  var c = true;
  //^Declares the condition variavle
  for (c) {
      //^^ Checks if the var c is true
      console.log("Looped once!");
      // ^^^ If the condition is true
      c = false;
      // ^^^^ Sets c to false so that it does not loop again

// ^^ Calls the loop function



The URL you posted is for a lesson on while loops you have created a for loop.

The syntax of a while loop looks like this:

while(condition) {
    // Do something!

Go though the lesson description and instructions again so that you can understand, If you still require help thereafter then paste in your code and we can help you.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.