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# Objects Loops and Final Touches Constants

Andreas Gruber
Andreas Gruber
2,142 Points

magic numbers challenge task

I don't know why he is asking me, if i have defined the String red?

CodeChallenge.cs
const int revenue = 125000;
string status = null;
const int revenueMin = 100000;
const int revenueMax = 150000;
const String colorRed = "red";
const String coloryellow = "yellow";
const String colorgreen = "green";

if (revenue < revenueMin)
{
    status = colorRed;
}
else if (revenue < revenueMax)
{
    status = coloryellow;
}
else
{
    status = colorgreen;
}

2 Answers

Steven Parker
Steven Parker
229,644 Points

:point_right: Try spelling "string" with a lower-case "s".

While "String" is a legitimate and compatible object type, the challenge evaluation program is probably not designed to accept anything other than the primitive "string".