31.12.2013 Views

TOPS-20 PASCAL Language Manual - Bitsavers

TOPS-20 PASCAL Language Manual - Bitsavers

TOPS-20 PASCAL Language Manual - Bitsavers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PASCAL</strong> STATEMENTS<br />

Example<br />

FOR I<br />

:= 1 TO 10 DO<br />

BEGIN<br />

IF Real_Array[IJ<br />

BEGIN<br />

Result := 0.0;<br />

GOTO 10<br />

END;<br />

0.0 THEN<br />

Result := Result + 1.0/Real_Array[IJ<br />

END;<br />

10: Invertsum:= Result;<br />

This example shows how you can use the GOTO statement to exit from a<br />

loop. The loop computes the sum (Invertsum) of the inverses of the<br />

elements of Rea] Array. If one of the elements is zero however, the<br />

sum is set to-zero; and the GOTO statement forces an exit from the<br />

loop.<br />

5.7 THE PROCEDURE CALL<br />

A procedure call specifies the actual parameters to a procedure and<br />

executes the procedure. (See Chapter fi for a complete description of<br />

procedures.)<br />

Format<br />

where:<br />

procedure name [(actual parameter [,actual parameter ..• ] )]<br />

procedure name<br />

actual parameter<br />

specifies the name of a procedure.<br />

specifies a constant, an expression, the name<br />

of a procedure or function, or a variable of<br />

any type.<br />

The procedure call associates the actual parameters in the list with<br />

the formal parameters in the procedure declaration. It then transfers<br />

control to the procedure.<br />

The formal parameter list in the procedure declaration determines the<br />

possible contents of the actual parameter list. The actual parameters<br />

must be compatible with the formal parameters. Depending on the types<br />

of the formal parameters, the actual parameters can be constants,<br />

variables, expressions, procedure names, or function names. An<br />

unindexed array name in a parameter list refers to the entire array.<br />

<strong>PASCAL</strong> passes actual parameters by the mechanism specified in the<br />

procedure declaration.<br />

5-14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!