GOTO
Jump to navigation
Jump to search
unconditionally transfers macro program control
<name> - Name of statement label GOTO is used in conjunction with the LABEL command to transfer the flow of control within a macro. <label> can be any string of alphabetic characters (including the underscore) or digits. "ABC", "THE_TOP", "100", and "123G" are all examples of valid statement labels. When a GOTO is encountered, the macro begins looking in the specified direction for a LABEL command whose argument exactly matches <label>. If it never finds such a LABEL command, it enters suspend (S-Midas) mode with an error. COMPUTED GOTOs Because the label matching occurs at run-time, it means that you can caret (^) a result label for the <label> argument, and a single GOTO can reference a number of labels depending on the value of the result. This can be useful when you want to perform a number of alternatives depending on the value of some result. It is usually advisable to use the "*" as the direction argument, since you may not know at the time of writing the macro whether the run-time destination will be above or below you. For example: goto case^which_one will look for LABEL CASE1 if WHICH_ONE = 1, LABEL CASE2 if WHICH_ONE = 2, LABEL CASE523.4 if WHICH_ONE = 523.4, LABEL CASESTOP if WHICH_ONE = STOP, etc. INTERACTIVE GOTOs Because the GOTO is a run-time command, it can be used at the S-Midas prompt after an error has occurred or the macro has PAUSEd. This can be very helpful in a debugging situation. Switches: NONE See Also: LABEL