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# Basics (Retired) Perform Converting Strings to Integers

Lukas Sarralde
PLUS
Lukas Sarralde
Courses Plus Student 406 Points

I still cant get this right. Even after few feedback....

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

Console.WriteLine(height + 10);

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

Console.WriteLine(height + 10);

2 Answers

Christopher Jr Riley
Christopher Jr Riley
35,874 Points

Don't worry about writing anything to the console, as it's not asking for that at all. You can remove...

Console.WriteLine(height + 10);

... and it will pass the first part just fine.

Steven Parker
Steven Parker
231,210 Points

You still need to update height.

Christopher's right that you don't need to output to the console, but you do need to update the value with an assignment statement:

height = height + 10;

Another, and more compact way to do this is with an addition assignment:

height += 10;

Either one will produce the same result and pass the challenge.