No module Published on Offcanvas position

12. CONTROL STATEMENTS

12.1 General Description

Control statements allow for the interruption of the normal sequence of execution of statements by causing execution to continue at a specified line, rather than at the one with the next higher line number.

The goto-statement


            GO TO line-number
        

allows for an unconditional transfer.

 

The if-then-statement


            IF expl rel exp2 THEN line-number
        

where "expl" and'texp2" are expressions and "rel" is a relational operator, allows for a conditional transfer.

 

The gosub and return statements


            GO SUB line-number
            RETURN
        

allow for subroutine calls.

 

The on-goto-statement


            ON expression GO TO line-number, ..., line-number
        

allows control to be transferred to a selected line.

 

The stop-statement


            STOP
        

allows for program termination.

 

12.2 Syntax


            1. goto-statement           = GO space* TO line-number
            2. if-then-statement        = IF relational-expression THEN line-number
            3. relational-expression    = numeric-expression relation numeric-expression /
                                          string-expression equality-relation string-expression
            4. relation                 = equality-relation / less-than-sign / greater-than-sign /
                                          not-less / not-greater
            5. equality-relation        = equals-sign / not-equals
            6. not-less                 = greater-than-sign equals-sign
            7. not-greater              = less-than-sign equals-sign
            8. not-equals               = less-than-sign greater-than-sign
            9. gosub-statement          = GO space* SUB line-number
            10. return-statement        = RETURN
            11. on-goto-statement       = ON numeric-expression GO space* TO line-number (comma line-number)*
        

admin