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 Start Coding

Will Turpin
Will Turpin
1,592 Points

Can't get System.Console.Write to print anything

Hi there, I am very new to all of this. I am at the beginning of c# basics and he is explaining the code that looks like this

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

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

    }
}

he then says to type into the console mcs Program.cs, ls, mono Program.exe

the program runs for him and returns the message he made but when I do it in work spaces no message comes back. Can anyone help me please?

3 Answers

Steven Parker
Steven Parker
229,771 Points

Did you save your changes before you compiled? If not, you just created an executable from the blank program that the workspace started with.

Look for a red dot to the right of the program name in the workspace tab. That's a reminder that your changes have not been saved. You can select "save" from the "edit" menu, or just type control-s. You can see where the instructor saves his code in the video and makes the red dot vanish, but he doesn't mention that he is doing it.

Stรฉphane Diez
Stรฉphane Diez
19,350 Points

and check the name of the file , it should be Program.cs

Ryan Anderson
Ryan Anderson
630 Points

I wrote mine exactly like his, but it keeps giving me the error that "the name 'system' does not exist in the current context." Which it clearly does.... sooo is there a bug?

Will Turpin
Will Turpin
1,592 Points

Thank you! Saving it worked. I can move on. Woooh

Steven Parker
Steven Parker
229,771 Points

Remember to choose the "best answer". :)