/sys$common/syshlp/helplib.hlb PASCAL, Statements, GOTO, Examples *Conan The Librarian (sorry for the slow response - running on an old VAX) |
FOR i := 1 TO 10 DO BEGIN IF Real_Array[i] = 0.0 THEN BEGIN Result := 0.0; GOTO 10; END; Result := Result + 1.0/Real_Array[i]; END; 10: Invertsum := Result; This example shows how to use a GOTO statement to exit from a loop. The loop computes the sum of the inverses of the components of the variable 'Real_Array'. If the value of one of the components is 0.0, the sum is set to 0.0 and the GOTO statement forces an exit from the loop.
|