What does block mean?
A group of lines that belong together and run as one unit: the body of an if, a loop or a function. In Python a block is marked by indentation.
In a lesson
The two lines pushed in by four spaces are a block: a group of lines that belong to the
ifline above them. Theifline ends with a colon:, which is Python's way of saying "a block starts on the next line".
Learn it
- Taught in F2.1 Blocks and indentation Decisions and loops, GCSE
Used in
- F1.3 Calling functions
- F2.2 Selection: if
- F2.3 else, elif and Boolean operators
- F2.4 Nested selection and match
- F2.5 Count-controlled loops: for
- F2.6 Condition-controlled loops: while
- F2.7 Loop patterns
- F4.1 Writing functions
- F5.3 Pseudocode and the exam reference language
- F6.5 Languages and translators
and 28 more lessons.
Do the lesson in the simulator