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 Receiving Input

Jim Conachan
Jim Conachan
2,514 Points

C# class, Workspaces Compiler not showing results

I'm in the beginning stages of the C# course and mono Program.exe does not return any result. The code is correct. For example:

treehouse:~/workspace$ mono Program.exe (Enter)

returns: treehouse:~/workspace$

it does not return the string that's been coded:

System.Console.Write("Enter how many minutes you exercised: ");

Steven Parker
Steven Parker
229,644 Points

To enable a complete and accurate analysis, make a snapshot of your workspace and post the link to it here.

5 Answers

Steven Parker
Steven Parker
229,644 Points

You're talking about task 2 of a multi-task challenge.

The work that involved Write() was done in task 1.

In a multi-task challenge, instead of starting over for each task, you continue working where you left off. Unless the challenge asks you specifically to change something previously done, the work you did in the other tasks will remain as-is while you add more code for each following task.

Jim Conachan
Jim Conachan
2,514 Points

Well, for some reason it started working.

I've got an issue though with one of the challenge questions. I feel like my answer is either correct, OR I've not learned this yet.

Question: Use the System.Console.ReadLine method to read the user's response from the console and store it in a variable named bookTitle.

I wrote:

string bookTitle = System.Console.ReadLine();

It says this is incorrect and asks, Are you calling the 'Write()' method as specified in the instructions?

The instructions don't specify the Write method. It specifies using the method I used ('ReadLine').

What am I doing wrong here?

Jim

Jim Conachan
Jim Conachan
2,514 Points

Thank you Steven for your patience. I did actually see that part of the instructions in smaller print, but I don't think I've learned yet from the lessons how to answer this question. i.e. using both the Write and the ReadLine. I'll keep playing with it. Thanks again. Jim

Jim Conachan
Jim Conachan
2,514 Points

STEVEN! I get it now! It was definitely me not quite understanding we keep the Write line from the previous question and add the ReadLine, as you would in a normal Class. I just finished the SQL class and everything tested was separated. Thank you so much.

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

This of course worked.