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) Perfect var

When asked to change the variable types to "var", It continuously asks if I have changed the 'String' variable to "Var".

Is there something that needs to be done to a string variable in order to make this go through? or am I missing something on another variable that is causing this error?

CodeChallenge.cs
string input = "22";

var converted = int.Parse(input);

var wheelsAreRound = true;

var downcased = "DoNuTs".ToLower();

var success = (downcased == "donuts");

vaar total = 0.0;

3 Answers

Hey Cody,

For this challenge, your prompt is to change all variable types to 'var'. Currently, you still have input as type string. You also have spelt var incorrectly on the total variable.

var input = "22"; // Change string to var

var converted = int.Parse(input);

var wheelsAreRound = true;

var downcased = "DoNuTs".ToLower();

var success = (downcased == "donuts");

var total = 0.0; // Here

Misspelling var can hurt.

I completely missed the entire first line. This is why you don't drink and write. Thank you very much.