Scope of names
Readers might think there is a conflict between two points in this tutorial. On the one
hand, we have said that names are defined as expressions only once in a program; on the
other hand, many of the examples use the same variable names repeatedly. Both points
are true, but need to be refined.
Every name is defined exactly once within a given scope. Every function definition
defines its own scope, and some constructs within definitions define their own narrower
scopes. Fortunately, the "offside rule" that defines subelements also precisely defines
variable scoping. A variable (a name, really) can only occur once with a given
indentation block. Let's see an example, much like previous ones: