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#

null

null

5 Answers

Jon Wood
Jon Wood
9,884 Points

Looks like you have a ; at the end of the Main method - public static void Main();. Just remove that and that error will go away.

Also, I noticed that the Console.ReadLine doesn't have parentheses. That's going to cause a compile error as well. Just add them on and it should all work. :)

it didnt compile. is it a bug with workspaces?

Jon Wood
Jon Wood
9,884 Points

I forked your workspace and made some changes - https://w.trhou.se/53c08cubbp

Try to compare that between yours and see if you can get yours to work. Let me know if you still can't get it. :)

it still did not work.... is there something wrong with workspaces?

Jon Wood
Jon Wood
9,884 Points

That's weird. It worked when I tried it. Are you running mcs Calculator.cs to compile?

what do you mean? i type this in the console to run it: clear && mcs Program.cs && mono Program.exe

oh ok, I ran it wth MCS Calculator.cs and it compiled. how does that work? why didn't clear && MCS Program.cs && mono Program.exe work? can you explain this to me? I'm new to coding but THANK YOU SO MUCH!! YOU ARE SO HELPFUL!!!!!

also in the code that you made to help me, I did not understand the int.parse can you explain what that means?

Jon Wood
Jon Wood
9,884 Points

Sure! The Main method was in the Calculator.cs file so that's the file that needed to be compiled. If you wanted to you could move the code to the Program.cs file.

The int.Parse method takes in a string and attempts to parse it into an integer.