Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C#

Challenge Task 2 of 2 Add 10 to height and store result back into height.

string heightInput = "168"; int height = int.Parse(heightInput);

ok so , please explain to me where I need to add the 10 to? Sorry a bit confused here

3 Answers

cm21
cm21
150,854 Points

Hi Willem,

I managed to find the challenge--to receive faster answers, I recommend mentioning which challenge/course you are referencing, so that people know exactly which task you're discussing.

For this step, you need to add 10 to height. There are two common ways one might go about solving this:

height = height + 10;

Or

height += 10;

string heightInput = "168";
int height = int.Parse(heightInput);
height += 10;

Hope this helps!

Rune Andreas Nielsen
Rune Andreas Nielsen
5,342 Points

From what it sounds like to me, you should just add 10 to the height. So it will look like this.

string heightInput = "168"; int height = int.Parse(heightInput); height = height + 10;

You can also do it this way string heightInput = "168"; int height = int.Parse(heightInput); height += 10;

Yeah thank you, had a blank moment there, appreciated kindly