Have you ever written something and then forgotten what you meant later? π
That can happen when you write code too!
Comments are little notes that programmers put inside their code to explain what the code does. The computer doesnβt run the comment β it simply ignores it.
For example:
# Say hello to the player print("Hello!")
The comment tells us what the next line of code is doing.
π§ Why Do Programmers Use Comments?
1
They help you remember.
If you come back to your code weeks later, comments can remind you what you were doing.
2
They help other people.
When someone else looks at your code, your comments can help them understand it.
3
They make tricky code easier.
You can leave yourself a little clue about what a complicated part of your program does.
Think of comments like little sticky notes for your code! ππ»
π Try It Yourself
So, the next time you are coding, try leaving a comment. Your future self might say:
π Future You Saysβ¦
βThank you!β π