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) Console I/O Variables

Anthony Correia
Anthony Correia
3,481 Points

cant figure it out

why is this code not compiling for the first objective?

CodeChallenge.cs
class Program
{
    static void Main()
    {
        // Prompt user for minutes exercised 
        System.Console.Write("Enter how many minutes you exercised: ");

        System.Console.ReadLine(); 

        string bookTitle; 

        // Add minutes exercised to total 
        // Display total minutes exercised to the screen 
        // Repeat until user quits    
    }
}

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! You're putting in code that the challenge hasn't asked for, including the definition of a Class and a Main method. These are not required by the challenge nor asked for. Also, you've included two Console methods that aren't specified by the challenge instructions. The entirety of the code needed for the first step of the challenge is in there if you erase all the things not specified by the instructions.

Keep in mind that it's always best to not do anything a challenge doesn't explicitly ask for. Even if functional outside the challenge, it can cause the challenge to fail. These challenges are extremely strict and testing for very specific things.

Here's what it was looking for:

string bookTitle; 

Good luck! :sparkles: