Although simple, this program illustrates many points: 

1. The simplest form of the procedure heading, namely: procedure Identifier; 

2. Blocks. A procedure is a block with a name. The program block is MinMax2 and the procedure block is MinMax. In this case the part of the Program 6.1 used only to find the minimum and maximum values is isolated and given the name MinMax. Just like the program block, the block constituting a procedure has a declaration part which introduces the objects local to the procedure. 

3. Local Variables. Local to procedure MinMax are the variables Item, First, Second, Min and Max; assignments to these variables have no effect on the program outside the scope of MinMax. Local variables are undefined at the beginning of the statement part each time the procedure is activated. 

4. Global Variables. A, Item and Increment are global variables declared in the main program. They may be referenced throughout the program (e.g., the first assignment in MinMax is Min : = A [1] ). 

5. Scope. Note that Item is the name for both a global and a local variable. These are not the same variable! A procedure may refer to any variable non-local to it, or it may choose to redefine the name. If a variable name is redeclared, the new name/type association is then valid for the scope of the defining procedure, and the non-local variable of that name (unless passed as a parameter) is no longer available within the procedure scope. Assignment to the local variable Item (e.g., Item : = Item + 2) has no effect upon the global variable Item, and because within MinMax the local Item has precedence, the global Item is effectively inaccessible. 

It is a good programming practice to declare every identifier which is not referred to outside the procedure, as strictly local to that procedure. Not only is this good documentation, but it also provides added security. For ex­ ample, Item could have been left as a global variable; but then a later extension to the program which activated procedure 

