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

I dunno what Im doing here


string heightInput = "168";
var height= int.Parse (heightInput);
Kevin Oneill
Kevin Oneill
6,509 Points
string heightInput = "168";
int height = int.Parse(heightInput);

2 Answers

Steven Parker
Steven Parker
215,939 Points

The challenge is being pickier than the language.

As Kevin suggested, you can pass the challenge by explicitly declaring your variable as int.

But in practice, it should be equally effective and acceptable to declare it using var.
You might want to report this as a bug to Support.

Thanks again Steven