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 trialali raafat
444 Pointsi need help i don't know my mistake
it's telling me there is something wrong with the output
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
try
{
string input = Console.ReadLine();
if (input == "quit")
{
string output = "Goodbye.";
}
else
{
string output = "You entered " + input + ".";
}
}
catch(Exception)
{
Console.WriteLine(output);
}
}
}
}
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHey Ali,
Stephen Parker provided sufficient information in the same question you posted yesterday.
In addition to his response, you are adding code that should not be added. The challenge did not say anything about a try/catch
block. It only wants you to fix the code and not change the functionality. So, you will need to reset the challenge back to the original code.
I will provide an additional hint: You have to alter 3 lines of code (one you've already done correctly), and add one line of code (a declaration
not an initialization for the output
variable to be done outside of the if/else
clause.
Have a another look at Stephen's hints, particularly the additional ones he left in a comment, and I'm sure you'll get it.
Keep Coding! :)