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

Borislav Yordanov
Borislav Yordanov
4,800 Points

I 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

CodeChallenge.cs
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; 
} 
Lewis Gilbert
Lewis Gilbert
2,082 Points

const 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; }

2 Answers

Steven Parker
Steven Parker
231,248 Points

Try 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
Briain Corroon
13,689 Points

Steven is correct. Any space before or after the conditional expressions will fail the challenge. Ridiculous bug.

Borislav Yordanov
Borislav Yordanov
4,800 Points

Thank you for the answer! I passed !