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 trialWill Turpin
1,592 PointsCan'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
231,269 PointsDid 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.
Ryan Anderson
630 PointsI 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
1,592 PointsThank you! Saving it worked. I can move on. Woooh
Steven Parker
231,269 PointsRemember to choose the "best answer". :)
Stéphane Diez
19,350 PointsStéphane Diez
19,350 Pointsand check the name of the file , it should be Program.cs