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 trialmehmet odabas
2,120 Pointscompiler error in if else statement
StudentsCode.cs(14,39): error CS1056: Unexpected character ?'
StudentsCode.cs(14,40): error CS1525: Unexpected symbol
is'
StudentsCode.cs(14,48): error CS1644: Feature type pattern matching' cannot be used because it is not part of the C# 6.0 language specification
StudentsCode.cs(14,49): error CS1040: Preprocessor directives must appear as the first non-whitespace character on a line
StudentsCode.cs(14,51): error CS1056: Unexpected character
?'
StudentsCode.cs(14,51): error CS1525: Unexpected symbol `)'
Compilation failed: 6 error(s), 0 warnings
compiler gave that errors but i couldn't get where did i do sth wrong
string language = Console.ReadLine();
if(language == "C#")
{
System.Console.WriteLine("C# Rocks!");
}
else
{
System.Console.WriteLine(language + “ is not C#.”);
}
2 Answers
William Li
Courses Plus Student 26,868 PointsIt appears that the " " in your code is the Unexpected symbol
, I wonder, are you using a non-US keyboard setting?
string language = Console.ReadLine();
if(language == "C#")
{
System.Console.WriteLine("C# Rocks!");
}
else
{
System.Console.WriteLine(language + " is not C#.");
}
This should work fine.
HIDAYATULLAH ARGHANDABI
21,058 PointsI think it is a problemwith keyboard
mehmet odabas
2,120 Pointsmehmet odabas
2,120 Pointsi'm using TR(turkish) keyboard setting but in javascript lessons or c# lessons before this exam, there was not any problems. i only get a problem like that in this exam.
Andy Swinford
8,152 PointsAndy Swinford
8,152 Pointsdefinitely the weird quotation marks causing the issue.
stephen Capes
1,002 Pointsstephen Capes
1,002 Pointsit doesn't it throws up "I entered "bogus" and "bogusis not C#." was printed out."