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 trialultan gannon
5,876 PointsDont even understand why its not running to begin with let alone after I edit it!
?
using System;
namespace Treehouse.CodeChallenges
{
class Program
{
static void Main()
{
input = Console.ReadLine();
if (input == "quit")
{
string output = "Goodbye.";
}
else
{
string output = "You entered " + input + ".";
}
Console.WriteLine(output);
}
}
}
1 Answer
Steven Parker
231,248 PointsThis code has a number of intentional errors.
This challenge is different from most in that regard. But here's a few hints:
- a variable must be declared before it can be assigned (or at the same time as the first assignment)
- a variable can only be declared one time
- a variable can be assigned multiple times
- a variable should be declared in the outermost scope in which it is used
Look for places in the code where one or more of these rules is violated. You should find at least 3 errors involving 2 different variables.