Table of Contents

SUB

The SUB keyword starts a subroutine block.

Syntax

SUB <name> ([<arg> AS <type>[, <arg> AS <type>]...]) [OVERLOAD] [PRIVATE|SHARED] [STATIC]
  <statements>
END SUB
  • <name> must be a valid identifer
  • The argument list is optional, but the parenthesis () must be included
  • The OVERLOAD keyword must be given if the function overloads another function with the same name
  • If the subroutine is defined in a TYPE block, the PRIVATE keyword indicates that the subroutine may only be called from within that TYPE block.
  • The SHARED keyword indicates that the function is visible from within other code modules
  • The STATIC keyword indicates that no stack frame is allocated on each subroutine call. See static_vs_dynamic

See also