What are some good use cases for comments?


#1

Question

What are some good use cases for comments?

Answer

Comments are best used for documenting code. With comments, a developer can explain what they want their code to do so that when another developer reads through the code they’ll have a better idea how it works and how it was intended on working. Another common use case for comments is to save code for later or temporarily remove code. If you surround the code you no longer want active in comments, then you remove it from play while still being able to read it so you can modify it at a later time, this is called commenting code out.