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

Jorge Kalil
Jorge Kalil
1,832 Points

string heightInput = Console.ReadLine(); int height = int.Parse(heightInput);

Why won't you accept this as resolution to the exercise

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

1 Answer

William Li
PLUS
William Li
Courses Plus Student 26,868 Points

The 1st line of code given by challenge was.

string heightInput = "168";

Somehow you changed its value from 168 to 0, that's what's causing the code to fail, because altering the value of this variable has side-effect on the height variable on line 2 as well.