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 Say Hello!

Are single quotes a valid for of signifying text in C#?

The quiz doesn't accept the single quotes which I placed the first time and I wondered if single quotes were valid in their place.

1 Answer

Steven Parker
Steven Parker
231,236 Points

:point_right: There are some languages (like JavaScript and Python) which use more than one token to indicate strings, but in C# only the normal quote character (") is used to indicate a string.

The apostrophe (a.k.a "single quote") is used in C# to indicate single characters:

string s = "This is a string";
char c = 'x';  // this is a single character