Ask coding questions

← Back to all posts
Whats wrong
h
JacobMcPherson1 (193)

I'm getting an error that says I have an unexpected identifier and I can't fix it. Can someone help? I'm pretty new to C# so don't judge me, please

Answered by MocaCDeveloper (560) [earned 5 cycles]
View Answer
Comments
hotnewtop
MocaCDeveloper (560)

Line 8-19 should be as so:

    if (lol == '1') 
    {
      Console.WriteLine ("How much time do you want to count to in seconds");
      int y = Convert.ToInt32(Console.ReadLine());
      int hehe;
      for (hehe = 0; hehe < y + 1; hehe++) 
      {
        Thread.Sleep(1000);
        Console.Clear();
        Console.WriteLine (hehe);
      }
    } // you missed this.
    else if (lol == '2')

On line 18, you had the closing curly brace for the for loop, but you failed to put the closing curly brace for the if statement.