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 Validating Input

Trying to follow video code not passing keep getting the error message

I get this mcs program.cs && mono Program.exe
(1,12): error CS1525: Unexpected symbol .', expecting,', ;', or=' and this mcs -debug Program.cs && mono --debug Program.exe
(1,12): error CS1525: Unexpected symbol Program' (1,33): error CS1525: Unexpected symboldebug'

using System;

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

        bool keepGoing = true;
        while(keepGoing)

            // Prompt user for minutes exercised 
            Console.Write("Enter how many minutes you exercised or type \"quit\" to exit: ");
            string entry = Console.ReadLine();        

            if(entry == "quit")
            {
                keepGoing = false;
            }
            else
            {
                // Add minutes exercised to total 
                int minutes = int.Parse(entry);

                if(minutes <= 0)
                {
                    Console.WriteLine(minutes + " is not an acceptable value.");
                    continue;
                }
                else if(minutes <= 10)
                {
                    Console.WriteLine("Better than nothing, am I right?");
                }
                else if(minutes <= 30)
                {
                    Console.WriteLine("Way to go hot stuff!");
                }
                else if(minutes <= 60)
                {
                    Console.WriteLine("You must be a ninja warrior in training!");
                }
                else
                {        
                    Console.WriteLine("Okay, now you're just showing off!");
                }

                runningTotal = runningTotal + minutes;

                // Display total minutes exercised to the screen 
                Console.WriteLine("You've entered " + runningTotal + " minutes.");
            }
            // Repeat until user quits
        }

        Console.WriteLine("Goodbye");
    }
}

}

3 Answers

Thor Giversen
Thor Giversen
771 Points

I think you are missing a { to start your while loop. Not sure if that will fix all the error messages though.

Good luck :)

Thor Giversen well there suppose to be one but didn't fix it I still get the same error I even tried copying the code in the teacher's notes to see if it passes but didn't

Jeremy Maclin you whats going on?