SUB keyword

Defines a sub procedure to be called and execute parts of code. After the commands, END SUB must be used. Within a SUB, it is possible to use special keyword _OBJECT. SUBs are not executed until called. To call a SUB, simply use its name. SUBs are executed synchronously. All objects are global, so they can be called within a SUB.

Syntax

SUB name

Parameters

  • name: a unique procedure name. Cannot use recognized command names or variable names (required)

Example

SUB setBG
BGCOLOR #ADB9FF
END SUB
setBG 'Call the procedure

SUB selectWinner
IF _OBJECT = img1 THEN
'do something
END IF
END SUB
ON CLICK img1, selectWinner 'Procedure called when image is clicked

Go back to list of Keywords.