What does syntax mean?
The rules that say how a language's instructions must be written: the spelling, the brackets, the colons, the indentation. A syntax error is code that breaks those rules, and the program cannot run at all until it is fixed.
In a lesson
The syntax of a language is its rules of grammar: brackets that close, quotes that end, colons in the right places. Break a rule and Python cannot understand the program at all, so none of it runs, not even the lines before the mistake:
Learn it
- Taught in F1.4 Errors: syntax, runtime and logic Programming basics, GCSE
Used in
- F2.1 Blocks and indentation
- F5.3 Pseudocode and the exam reference language
- F6.4 Debugging logic errors
- F6.6 The IDE
- A1.3 Exception handling
- A1.5 Scope, lifetime and debugging in an IDE
- A4.5 Trees
- A6.5 Backus-Naur Form and syntax diagrams
- A9.6 AQA assembly language and bitwise operations
- A10.8 Stages of compilation, linkers and loaders
and 4 more lessons.
Do the lesson in the simulator