GOSUB     CALL
 
Syntax


GOSUB label

    or

CALL label

[CALL]  function/sub

CALL ( expr )

Description


GOSUB is supported for backward compatibility, now FUNCTIONs and SUBs and their implied CALL would be a 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.

CALL (expr) was added in 7.40 compiler which allows calls to a pointer to a function.  The first right parenthesis is required.  Parameter passing to this type of call is not supported.

Example

GOSUB message
END

message:
PRINT "Welcome!
return

sub print1111
  print 1111
endsub

main:
  fpointer = ADDRESSOF print1111
 
  call ( fpointer )
Differences from other BASICs

See also