# Syntax Error

> Code that breaks the grammar rules of its language. Not one line of it runs.

**Field:** Software Development  
**Category:** Programming Concepts  
**Also known as:** SyntaxError, Parse Error

## 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.

## Definition

A syntax error is code that breaks the grammar rules of its language. A missing bracket, a stray comma or a misspelled keyword are common causes. The computer cannot even read the program, so not one line runs. The message points to the line where it got confused. The real mistake is often on that line or the one just above it.

## Example

Jack types if score > 10 and forgets the colon in Python. The program will not start until he adds it.

## Example code

```python
>>> if score > 10
  File "<stdin>", line 1
    if score > 10
                 ^
SyntaxError: expected ':'
```

The colon is missing. Python says just what it wanted.

## Why it matters

They are the easiest kind to fix. The computer tells you where they are.

## Common mistake

Only looking at the line in the message. The missing bracket is often on the line before.

## Three principles

- **Nothing runs.** The program stops before the first line.
- **Easy to find.** The message points to the spot.
- **Look one line up.** The cause is often just above.

## Related terms

- [Error](https://learn.benibix.com/term/development/error)
- [Syntax](https://learn.benibix.com/term/development/syntax)
- [Runtime Error](https://learn.benibix.com/term/development/runtime-error)
- [Keyword](https://learn.benibix.com/term/development/keyword)

## Told apart from

- [Syntax Error vs Runtime Error](https://learn.benibix.com/compare/syntax-error-vs-runtime-error): A syntax error stops the code before a single line runs. A runtime error waits until the code hits a bad value.

## Taught in

- [Bugs and Error Types](https://learn.benibix.com/learn/development-concepts/bugs-and-error-types): Programming Basics, 15/18

---

Source: https://learn.benibix.com/term/development/syntax-error
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
