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 Variables

string entry = ("bookTitle"); how do i initialize this to write book title?

string entry = ("bookTitle"); how do i initialize this to write book title?

CodeChallenge.cs
System.Console.Write("bookTitle: ")
string entry = System.Console.ReadLines();

3 Answers

Steven Parker
Steven Parker
231,210 Points

It looks like you got a little "carried away".

This is a basic exercise in variable declaration and initialization. You won't need to call any System.Console methods for this challenge.

Task 1 of the challenge says, "Declare a string variable named bookTitle.", but your string is named "entry". I'm not sure how you got to task 2, or did you change it after passing task 1?

Then to initialize it "with the title of your favorite book", just add an equal-sign and put your book title inside quotes. That's all you need, nothing fancy here.

figured it out thanks

I'm in a predicament here as well.

string bookTitle; worked out fine bookTitle = "Chariot of the Gods"; OR bookTitle = ("Chariot of the Gods"); both not being accepted. What am I doing wrong here?

Steven Parker
Steven Parker
231,210 Points

You still need to keep the word string before the variable name ... it looks like you removed that?