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 trialKeonee Lesley
4,714 Pointshow to Add 10 to height and store result back into height?
a bit confused
string heightInput = "168";
int height = int.Parse(heightInput);
1 Answer
Steven Parker
231,275 PointsYou could explicitly assign "height" to itself plus the value, or just use the "addition assignment" operator instead:
height += 10;
Manuel Alvarez
5,383 PointsI don't understand what it wants us to do? int height = heightInput + 10;
Steven Parker
231,275 PointsYou're done with "heightInput" now that you passed the previous task. Now you only need to increase the converted value by 10.
Try one of the suggestions I made above.
Manuel Alvarez
5,383 PointsI used your example, height += 10; and it gives me a try again answer. I typed it the way you put it.
Steven Parker
231,275 PointsIf I paste that line directly into the challenge after yours, it passes task 2. Note that if you put it in before the task 1 validation, it produces the wrong value for that step and would indeed result in a "try again".
Manuel Alvarez
5,383 PointsYou are right. Thank you so much for your help and patients.
Manuel Alvarez
5,383 PointsManuel Alvarez
5,383 PointsI also do not understand this code challenge. Please help.