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 trialJordan Botts
1,860 PointsWhy do input and output not exist?
No sure why input and output do not exist in this block of code, they are all in the static void section.
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 challenge is mostly about correcting errors in scope. Some things to watch for:
- Variables used in more than one scope must be declared in the outermost scope.
- Variables can only be declared once.
- Variables must be declared before they are used.
- Remember that a new scope is created whenever you see an open brace ({)
Hopefully you can fix the code errors with these hints and pass the challenge.