Each label: 

1. must appear in the label declaration prior to its occurrence in the block. 

2. must prefix one and only one statement appearing in the statement part of the block. 

3. has a scope over the entire text of that block excepting any nested blocks that redeclare the label. 

At least one of the following three conditions must hold for labels and the goto statements which refer to them: 

1. The label prefixes a statement which contains the goto statement. 

2. The label prefixes a statement in a statement sequence (within a compound statement or repeat statement) and any statement in the statement sequence contains the goto statement. 

3. The label prefixes a statement in the statement sequence forming the statement part of a block that contains a proce­ dure or function declaration that contains the goto. 

Example (programfragment): 

label 1; { block A } procedure B; { block B } label 3, 5; begin goto 3; 3: Writeln('Hello'); 5: if P then begin S; goto 5 end; { while P do S } goto 1; this causes early termination of the activation of B } Writeln('Goodbye') end; { block B } begin B; 1: Writeln(' Edsger') { a "goto 3" is not allowed in block A } end { block A } 

