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 trialBhargav Chava
1,706 PointsReplace the magic numbers and strings in the if / else if / else statement with constants.
whats wrong in this? it says did you change if/else if/else error
const int revenue = 125000;
string status = null;
const string r="red";
const string y="yellow";
const string g="green";
const int num1=100000;
const int num2=150000;
if (revenue < num1 )
{
status = r;
}
else if (revenue <num2 )
{
status = y;
}
else
{
status = g;
}
1 Answer
Steven Parker
231,275 PointsYou're going to love this one.
I removed the spaces between the constant names and the closing parentheses of the expressions and it passed.
You may want to report this as a bug to Support.
Bhargav Chava
1,706 PointsBhargav Chava
1,706 Pointswow! it worked so funny!
Demar Jones
10,583 PointsDemar Jones
10,583 Pointsthank you!! Steven this was driving me crazy!