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 Integers

Zyeshawn wilson
Zyeshawn wilson
353 Points

Help they never went over this well they did but not the integration of both one without "" and the other one without ""

What is "6" + 5 = ?

Benny Ogidan
Benny Ogidan
17,948 Points

putting this means 6 is taken as a string and 5 will remain an int, it is concatenated to 5 so the result will be 65

1 Answer

Steven Parker
Steven Parker
229,744 Points

This is a case of "implicit type conversion".

When the compiler sees a plus sign ("+") following a string, it recognizes it as the concatenation operator. This operator works on two string values but it finds a number in the place of the second value. So it sees that there is a standard way to convert a number into a string and performs an implicit type conversion, making the number into the string "5". Finally, the concatenation is performed resulting in the string "65".