Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Basics (Retired) Perfect if / else if / else

Paul Vogel
Paul Vogel
457 Points

Program.cs(48,33): error CS1519: Unexpected symbol `(' in class, struct, or int erface member declaration

I'm missing something, I just can't tell what. It apparently doesn't like the '(' on the ("Goodbye") but I don't know.

namespace Treehouse.FitnessFrog { class Program { static void Main() { int runningTotal = 0; bool keepGoing = true;

    while (keepGoing)
    {
      //prompt user for minutes exercised
      System.Console.Write("Enter how many minutes you exercised or type \"quit\" to exit: ");

      string entry = System.Console.ReadLine();

      if(entry == "quit")
      {
           keepGoing = false;
      }

        int minutes = int.Parse(entry);

         if(minutes <+ 10)
         {
           Console.WriteLine("Better than nothing, am I right?");
         }
          else if(minutes <= 30)
          {
            System.Console.WriteLine("Way to go hot stuff!");

          }
          else if(minutes <= 60)
          {
            System.Console.WriteLine("You must be a ninja warrior in training!");
          }
          else
          {
            System.Console.WriteLine("Okay, now you're just showing off!");
                                     }                                                    
    runningTotal = runningTotal + minutes;                           

        System.Console.WriteLine("You've entered " + runningTotal + " minutes");
        }

    }

    System.Console.WriteLine("Goodbye");

}

}

1 Answer

Steven Parker
Steven Parker
229,968 Points

Line 48 is outside the definition for "Main", I expect you meant to have it be inside.

Also I noticed a couple of other issues:

  • on line 24 there is "<+" instead of "<="
  • on line 26 the "System" namespace prefix is missing
Paul Vogel
Paul Vogel
457 Points

Thanks man. I cut the goodbye line and pasted up a curly bracket, corrected those other things and it worked.