
Chapter 3. Program Structure
49
3.1.2 Notes for Jumping into/out of Statement Blocks
It is not recommended to jump control from a main routine or subroutines into the midst of
significant statement blocks or to jump out from the midst of those statement blocks, using the
GOTO statement.
Statement Blocks Jump into Jump out
Subroutine
Error-/event-handling routine
Block-format user-defined function
Block-structured statement
×
×
×
×
×
×
×
△
×: To be avoided. A run-time error may occur.
△: Not recommended, although no run-time error will result directly. Nesting may cause a
run-time error.
• It is possible to jump control out of the midst of block-structured statements (except for
FOR...NEXT) by using the GOTO statement.
• Avoid jumping the control out of the midst of FOR...NEXT statement block with the
GOTO statement. The program given below, for example, should be avoided.
FOR I%=0 TO 10
IF I%=5 THEN
GOTO AAA
ENDIF
NEXT I%
AAA:
NOTE
Generally, the frequent or improper use of GOTO statements in a program will
decrease debugging efficiency and might cause fatal run-time errors. You are,
there-fore, recommended to avoid using GOTO statements, if possible.
Comentarios a estos manuales