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) Perfect if / else if / else

I get a program error

So I followed step by step and I keep getting these errors:

Program.cs(34,19): error CS1002: ; expected
Program.cs(35,40): error CS1525: Unexpected symbol )' Program.cs(36,19): warning CS0642: Possible mistaken empty statement Program.cs(38,19): error CS1002: ; expected Program.cs(39,18): error CS1525: Unexpected symbolelse'
Program.cs(42,19): error CS1002: ; expected
Compilation failed: 5 error(s), 1 warnings

So I went over step by step, with the same result. then I just copy paste the teachers notes to see if I would get the same error and I did. Is something wrong with my Workspace? This is not the first time I come across this issue. can someone give me suggestions on how to fix this?

Could you show us your actual code please?

2 Answers

You haven't included a link to your workspace so I can't check it for errors, but I can explain what these warnings are saying.

Program.cs(34,19): error CS1002: ; expected

This is telling you that on line 34 in the Program.cs file you are missing a semi-colon. We know this because of the numbers in the brackets. The first number is the line number and the second number is the column number (how many characters into the line (including whitespace) the error is). This error also appears to be happening on line 38 and 42. (Just a heads up, these numbers aren't always 100% accurate but they do help narrow down where the error is coming from)

Program.cs(39,18): error CS1525: Unexpected symbol else

This says that it wasn't expecting to see the word else on line 39 so chances are you forgot your closing curly brace on the if statement just before the else

Thanks for the suggestions, and the semicolons was missing on two defenitions. so I checked every line, and found just one error. looking better than before lol

Program.cs(33,33): error CS0117: System.Console' does not contain a definition forWriteline'
/usr/lib/mono/4.5/mscorlib.dll (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings

Any suggestions why?

https://teamtreehouse.com/workspaces/33656172#

The link you have given doesn't work but it looks like a small typo as you have written "Console.Writeline" instead of "Console.WriteLine" (needs both a capital W and L) on line 33 of Program.cs

Ahhh need new glasses missed that one thank you. for your help