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 Console I/O

Philip Amofah
Philip Amofah
99 Points

How do i use System.Console.Write() to print a message?

I just started the course and i'm a little stumped. Please help

CodeChallenge.cs
string bookTitle = System.Console.ReadLine

System.Console.Write("Enter a book title:");

1 Answer

Steven Parker
Steven Parker
231,248 Points

It would print a message just fine how you have it. But the challenge has some other specific requirements that you need to meet:

  • there should be a semicolon (;) at the end of each statement
  • you need a space between the colon and the closing quote in "Enter a book title: "
  • when you call a function, you just have parentheses () after it, even if you don't pass any arguments.
  • you need to call ReadLine after the Write.
  • you should keep your original declaration and assignment of bookTitle

At the end of task 4, you'll have something like this:

string bookTitle = "My Book Title";

System.Console.Write("Enter a book title: ");
bookTitle = System.Console.ReadLine();