The Procedure Body

For purposes of scoping, a procedure declaration may be regarded as a block as the place where it appears on the program sheet (even though this might be an illegal position). Everything except the body of the procedure can be disregarded, and the formal parameters treated as though declared within the body, labels included. Identifiers which are non-local to the procedure body are those in scope at the place of the procedure declaration, subject to the restrictions given in . Actual parameters must, of course, be in scope at the procedure call. For example, the block:


          BEGIN
          INTEGER i;
    INTEGER
          PROCEDURE p; ANSWER i;
    i := 0;
    BEGIN
          INTEGER i;
        i := 2;
        print (p);
    END
          END
        

has the effect of printing 0.