Comments

What are comments?

Comments are lines in a program that the program ignores when it executes. They allow you to add notes about how the program works to help you and other developers understand the code.

Why are comments useful in programming?

Writing comments will remind you what your code does when you return to it later. Comments also help teams of programmers collaborate effectively.

What kinds of comments should you write?

Comments are used to explain the role of important variables when you introduce them, how you've approached a problem after considering multiple approaches, what your functions do, and what classes are used for in the program.