From the course: Programming Foundations: Fundamentals

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Working with comments

Working with comments

- Comments are notes to your future self and others to describe what your code does. Right now, we have small programs. We can keep the flow of it all in our heads, but over time as you continue to grow your programming skills, you'll be writing much longer programs. Some may even be thousands of lines of code spread over dozens of files. It would be impossible to keep all of that in your head. By adding comments to your code, you can document the purpose of the different variables, functions, and classes. You can think of them as virtual sticky notes. Here we are with our program that asks the user for their name and also asks if they're enjoying the course. Comments are started with hash marks. Let's add our very first comment here on line number one. We'll type the hash mark and then a space and type greet the user. Notice how the entire line is now colored green. This is how the IDE is letting us know that this…

Contents