Skip to content
BENIBIX Learn

Comment

Development🧩 Programming ConceptsPrograms

Also known as Code Comment

A note in the code for people. The computer skips it.

Think of it like

Think of it like a sticky note on a recipe. The cook reads it, but it is not a step.

Example

Lucy writes # prices include tax above one line. Next year a new teammate reads it and does not add the tax twice.

Why it matters

Code is read far more often than it is written. A short note saves the next reader an hour of guessing.

Definition

A comment is a note inside the code that the computer skips. It is written for people, not for the machine. In Python a comment starts with #, and in many other languages with //. Good comments say why the code does something, not what it does. The computer runs the same program with or without them.

Example code

python
# Prices already include 20% tax
total = price * quantity
The first line is for people. The computer only runs the second.

Common mistake

Writing comments that repeat the code, like add one to x. Say why, not what.

Key takeaways

  1. 1
    For people. The computer skips every comment.
  2. 2
    Say why. The code already shows what it does.
  3. 3
    Keep it true. An old, wrong comment is worse than none.

Learn it properly