[Solved] Trying to add two numbers, but it doesn’t work


Adding strings concatenates the strings.

Use TryParse to parse the strings into integers or doubles. Remember to check the return value! You must handle the case where the user fails to type in a valid number.

The reason I use the var keyword is because I want the person who is playing be able to choose both integers and floats.

You don’t understand what var means. var means “replace var with the type of the thing on the right”, and the thing on the right is of type string. It does not mean “allow any value in this variable”.

1

solved Trying to add two numbers, but it doesn’t work