pass — the silent keeper
The problem...
You're writing a loop. You need the structure to exist — but you're not ready to fill it in yet.
So you leave it empty. Python throws an error.
for letter in "Bull":
# TODO: add logic later
# IndentationError: expected an indented block
Python expects something inside the block. A comment doesn't count.
The idea!
pass is a statement that does nothing. Intentionally. It tells Python: "there's nothing here yet — and that's fine."
The syntax
for letter in "Bull":
pass # valid — no error
The loop runs. Nothing happens. No output. No error. Python is satisfied.
A placeholder in action
for letter in "Bull":
pass
print("Loop done.")
# Loop done.
The loop runs four times. pass executes four times. Nothing is printed inside the loop — but the code after it runs normally.
Why it exists
Sometimes you need the structure before the logic. You're sketching the shape of your program — not filling it in yet.
for letter in "Bull":
pass # come back here later
It's a marker. A reserved space. A silent keeper holding the place until you're ready.
Heads up!
passdoes nothing — that's its entire job- A comment alone is not enough — Python needs at least one statement in a block
passis valid anywhere a statement is expected — loops, conditions, functions- It's a development tool — in finished code, a
passusually means something is missing
The mindset shift
Stop thinking: "My code needs to do something."
Start thinking: "Sometimes holding the space is enough."
What you should understand now
passis a valid statement that does nothing- It satisfies Python's requirement for an indented block
- Use it as a placeholder when the structure exists but the logic doesn't yet
- A comment alone won't work —
passwill