🧩Syntax Error
Also known as SyntaxError, Parse Error
Code that breaks the grammar rules of its language. Not one line of it runs.
Think of it like
Think of it like a sentence with no full stop and half a word. The reader gives up before the end.
Example
Jack types if score > 10 and forgets the colon in Python. The program will not start until he adds it.
Why it matters
They are the easiest kind to fix. The computer tells you where they are.
Definition
Example code
python
>>> if score > 10
File "<stdin>", line 1
if score > 10
^
SyntaxError: expected ':'Common mistake
Key takeaways
- 1Nothing runs. The program stops before the first line.
- 2Easy to find. The message points to the spot.
- 3Look one line up. The cause is often just above.