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

Brenden Seidel
Brenden Seidel
16,890 Points

When I run the program in the console, it just returns a new line and doesn't prompt the questions put forth.

Here's my code:

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

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

and here's the output:

treehouse:~/workspace$ mcs Program.cs                                                           
treehouse:~/workspace$ mono Program.exe                                                         
treehouse:~/workspace$

1 Answer

Steven Parker
Steven Parker
229,644 Points

:point_right: Did you save your last edit before you compiled?

I'm guessing you may not have, because compiling this code should have produced a warning about assigning a variable that is not used later. And of course, running the compiled program should display your message.

In the workspace, look for a red dot next to the filename on the tab. It's a reminder that you have made changes that have not yet been saved.

Brenden Seidel
Brenden Seidel
16,890 Points

Yep, that did it --- thanks!