GOSUB     CALL
 
Syntax


GOSUB label

GOSUB ( expression )

    or

CALL label

[CALL]  function/sub

CALL ( expression )

Description


GOSUB is supported for backward compatibility, now FUNCTIONs and SUBs  would be the preferred method.

Execution jumps to a subroutine marked by line label. Always use RETURN to exit a GOSUB, execution will continue on next statement after GOSUB.

label may be defined as label: or as a SUB or FUNCTION

CALL for a FUNCTION or SUB is optional.  When CALLing a FUNCTION the return value is discarded.

The version using an expression (parenthisis required) will compute the expression and then call the resulting address.

Example

GOSUB message
END

message:
PRINT "Welcome!
return
Differences from other BASICs

See also