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 trialBorislav Yordanov
4,800 PointsI need help here , Bummer : Did you change the structure of the if/elses if /else statement
I don't understand why i need to change the strucutre
const int revenue = 125000;
string status = null;
private const int revenue1= 100000;
private const string red="red";
private const int revenue2= 150000;
private const string yellow ="yellow";
private const string green="green";
if (revenue <revenue1 )
{
status = red;
}
else if (revenue < revenue2)
{
status = yellow;
}
else
{
status = green;
}
2 Answers
Steven Parker
231,268 PointsTry removing the "private" before your constant declarations (to make them like how "revenue" was declared).
And — you're going to love this one — remove the space between "revenue1" and the closing parenthesis of the if conditional expression.
You might want to report that last one as a bug to Treenouse Support. It might even get you "a special Exterminator badge".
Briain Corroon
13,689 PointsSteven is correct. Any space before or after the conditional expressions will fail the challenge. Ridiculous bug.
Borislav Yordanov
4,800 PointsThank you for the answer! I passed !
Lewis Gilbert
2,082 PointsLewis Gilbert
2,082 Pointsconst int revenue = 125000; string status = null; const int revenue1= 100000; const string red="red"; const int revenue2= 150000; const string yellow ="yellow"; const string green="green"; if (revenue < revenue1) { status = red; } else if (revenue < revenue2) { status = yellow; } else { status = green; }