Working with comments
You might have noticed that LearningCurve
has an odd line of text (10 in Figure 2.6) starting with two forward slashes, which were created by default with the script.
These are code comments! In C#, there are a few ways that you can use to create comments, and Visual Studio (and other code editing applications) will often make it even easier with built-in shortcuts.
Some professionals wouldn’t call commenting an essential building block of programming, but I’ll have to respectfully disagree. Correctly commenting out your code with meaningful information is one of the most fundamental habits a new programmer can develop.
Single-line comments
The following single-line comment is like the one we’ve included in LearningCurve
:
// This is a single-line comment
Visual Studio doesn’t compile lines starting with two forward slashes (without empty space) as code, so you can use them as much as needed to explain your...