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 trialJory Braun
7,814 PointsUh this is dumb, error: Did you include the boolean expression to evaluate? (value < 0) ?
(value < 0) ? textColor = "red" : textColor = "green";
int value = -1;
string textColor = null;
(value < 0) ? textColor = "red" : textColor = "green";
2 Answers
William Li
Courses Plus Student 26,868 PointsHi Jory,
I haven't taken this C# course, but usually I write the C# ternary this way.
textColor = (value < 0) ? "red" : "green";
Hope you find it helpful.
Charles Parko
2,012 PointsI don't have an answer, but will add, that I have no idea why your code (which is identical to mine) didn't pass. I did exactly what the instructor shows in the video. It would be really nice if after awhile, we got an explanation around what's wrong.
Jory Braun
7,814 PointsJory Braun
7,814 Pointsthat is far sexier
Jory Braun
7,814 PointsJory Braun
7,814 Pointsbut the question is very vague, I don't know why this wouldn't pass. This is my biggest complaint about treehosue. You get an error some times for no rhyme or particular reason.