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!
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! 😅
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
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);
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> -->
Interactive Comment Writer!
Pick a language, type your comment, press Run — see what happens!
Choose a language and type your comment note below!
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!
3 Comment Mistakes to Avoid!
I made all of these when I started — now you don’t have to!
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!
