Lesson 14 of 21 · 2 min
pass — Do Nothing (Placeholder)
The WHY — Why pass?
Python requires that every block of code has at least one statement. If you are writing code and have a block you have not filled in yet, pass is your placeholder — it says "I know this block exists, I will fill it in later."
for i in range(5): # loop 5 times
pass # do nothing — this is a placeholder until we add real code
if True:
pass # placeholder — come back and fill this in laterpass prevents Python from throwing a SyntaxError when you have an empty block. Remove it when you add real code.
