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

Hi Guys, Can I get some heads up here? Thank you

Guys,

I am not sure if i need to create some thing like:

int runningTotal+10;

and then use the Console.WriteLine(height)

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

Console.WriteLine(heightInput + "10"):

2 Answers

Antonio De Rose
Antonio De Rose
20,884 Points
3 errors
1) you should use height instead of heightInput in the last line
2) last line, for you cannot surround it with quotes.
3) after the last line, it should end with semicolon, and not colon
string heightInput = "168";
int height = int.Parse(heightInput);
Console.WriteLine(height + 10);
Daniel Turato
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Daniel Turato
Java Web Development Techdegree Graduate 30,124 Points
String heightInput = "168";
int height = int.Parse(heightInput);

Console.WriteLine(height + 10);

Not much wrong with your code, just syntax. First off, you were converting the String to an int correctly but afterwards you was concatenating the previous "168" string with "10". If you wanted to do it with two ints, you had to use height + 10 with the "". Also, you accidentally used : instead off ; at the end of the last line. My above code shows what I corrected, hope this helps.