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

ultan gannon
ultan gannon
5,876 Points

I dunno what Im doing here

?

CodeChallenge.cs
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
231,210 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.