Off-side rule

The off-side rule describes syntax of a computer programming language that defines the bounds of a code block via indentation.

[1][2] The term was coined by Peter Landin, possibly as a pun on the offside law in association football.

The colon (:) at the end of a control statement line is Python syntax; not an aspect of the off-side rule.

[5] The explicit structure of Lisp code allows automatic indenting, to form a visual cue for human readers.

ALGOL 68 and the Bourne shell (sh, and bash) are similar, but the end of the block is usually given by the name of the block written backward (e.g., case starts a switch statement and it spans until the matching esac; similarly conditionals if...then...[elif...[else...]]fi or for loops for...do...od in ALGOL68 or for...do...done in bash).

Custom is for the end token to be placed on the same indent level as the rest of the block, giving a blockstructure that is very readable.

Designer Martin Odersky said that this was the single most important way Scala 3 improved his own productivity, that it makes programs over 10% shorter and keeps programmers "in the flow", and advises its use.