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 trialTiago Ramos
2,380 Pointswhich variable is wrong?
Hey guys I can't figure out which variable is wrong. My thoughts go to 3 possibilities:
int converted;
string downcased; ( my intuition tells me this one is very likely )
bool success;
can you help me? thanks
var input = "22";
var converted = int.Parse(input);
var wheelsAreRound = true;
var downcased = "DoNuTs".ToLower();
var success = (downcased == "donuts");
var total = 0;
3 Answers
Ben Reynolds
35,170 PointsIt's the "total" variable. It needs to be a double not an int, so the value needs a decimal.
Ben Reynolds
35,170 PointsStrange, I just tried submitting your code and it worked, does it show you an error message?
Tiago Ramos
2,380 Pointshey Ben now it worked,
I had the old code commented and for some reason that was creating an error. thanks a bunch for the help ;)
Tiago Ramos
2,380 PointsTiago Ramos
2,380 Pointsgreat tip Ben I made the change:
var input = "22";
var converted = int.Parse(input);
var wheelsAreRound = true;
var downcased = "DoNuTs".ToLower();
var success = (downcased == "donuts");
var total = 0.0;
but there is still something wrong