Lesson 2 of 13

Comments: Notes in Your Code! 💬

Comments are little notes you leave inside your code. The computer ignores them completely — but YOU and your friends will thank you later!

// Python comment
# This is a note!
/* remember this */
// fix this later
🤔 What is a Comment?

Notes the Computer Ignores!

Write whatever you want — the computer won’t even see it!

When I first learned about comments, I thought — why write something the computer ignores? Then I came back to my own code one week later and had absolutely no idea what it did! That’s when I understood. Comments are notes for humans — not for computers. And they save your life! 😅

📓 Your Code + Your Notes
# This line says hello! ← computer skips this
print(“Hello!”) ← computer runs this
# score starts at zero
score = 0

📝 Types of Comments

3 Ways to Write Comments!

Different coding languages use different comment symbols!

🐍

Python Comments — Use #

In Python, you start a comment with the # symbol. Everything after it on that line is ignored. It’s the most beginner-friendly way to comment!

# This is a comment in Python!
# The computer ignores these lines
name = "Sara"   # store the name
print(name)      # show it on screen

# Multi-line? Just use # on each line!
# Line 1 of my note
# Line 2 of my note
🐍 Python Symbol: # Beginner Friendly
🌐

JavaScript Comments — Use // or /* */

JavaScript has two types! Use // for a single line comment, or /* */ to wrap a whole block of text in one comment!

// This is a single line comment
let score = 0;   // start at zero

/* This is a multi-line comment.
   You can write as many lines
   as you want inside here! */
console.log(score);
🌐 JavaScript // Single line /* */ Multi-line
🌍

HTML Comments — Use <!– –>

In HTML, comments look a little different — they start with <!– and end with –>. Great for leaving notes inside your webpage code!

<!-- This is the header section -->
<h1>Hello World!</h1>

<!-- TODO: add a button here later -->
<p>Welcome to my website!</p>

<!-- This code is hidden for now:
  <div>Secret content!</div>
-->
🌍 HTML <!– –> Web Pages

🎮 Write Your Own Comments!

Interactive Comment Writer!

Pick a language, type your comment, press Run — see what happens!

✍️ Comment Playground

Choose a language and type your comment note below!

my_code.py
1
#
2
print(“Hello, World!”)
3
4
name = “Sara”
// OUTPUT

💡 Why Comments Matter

4 Reasons to Always Comment Your Code!

Every professional developer writes comments — here’s why!

🧠

Remember What You Did

Come back to your code tomorrow — you’ll forget! Comments remind you what each part does.

🤝

Help Your Friends

When you share code, comments help others understand it quickly — like a guidebook!

🔧

Plan Before You Code

Write comments FIRST as a plan, then fill in the code. Professionals do this every day!

🙈

Hide Code Temporarily

Comment out broken code to test without it — then uncomment when you’re ready to fix!


😅 Common Mistakes

3 Comment Mistakes to Avoid!

I made all of these when I started — now you don’t have to!

print(“Hello”) # print(“Hello”)
🤔 Don’t just repeat the code as a comment — explain WHY, not WHAT!
✅ print(“Hello”) # greet the user on startup
name = “Sara” (no comment on a confusing line)
🤔 Complex lines need comments! Add a note so future-you understands.
✅ name = “Sara” # player’s display name in the game
// wrong symbol in Python: // comment
🤔 Use the RIGHT symbol for your language! Python uses #, not //!
✅ # This is the correct Python comment symbol!

🧠 Quick Quiz!
🎯 Comments Quiz

4 questions · pick an answer to check!

⭐ Remember This!

💬

Comments are notes for humans — the computer ignores them completely

#️⃣

Python uses #, JavaScript uses //, HTML uses <!– –>

🧠

Always comment confusing or important parts of your code

🤝

Good comments make you a better teammate and a better coder!