C# C# Basics (Retired) Perform Converting Strings to Integers

I have a question about C#

i am not sure how to add 10 to height

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

1 Answer

28,416 Points

You have to set height equal to itself + 10, like this:

height = height + 10;

Though since the above is such a common operation there is an operator += which acts as a shortcut for the above. That looks like this:

height += 10;

That does the exact same thing as the code in my first example.