25.170. SUB fun()

[<<<] [>>>]

This command should be used to define a subroutine. A subroutine is a piece of code that can be called by the BASIC program from the main part or from a function or subroutine.

SUB sub(a,b,c)
...
END SUB

The end of the subroutine is defined by the line containing the keywords END SUB.

Note that functions and subroutines are not really different in ScriptBasic. ScriptBasic allows you to return a value from a subroutine and to call a function using the command CALL. It is just a convention to have separately SUB and FUNCTION declarations.

For detailed information please read the documentation of the command FUNCTION


[<<<] [>>>]