Define a subroutine. CALL name runs it.
SUB name [([arg [AS type] [, …])]] statements EXIT SUB END SUB
CALL name [arg [, arg…]]
Parameters may use AS typename for a TYPE (see TYPE). SUBs take TYPE args the same way: SUB Hi(m AS Message). For a routine that returns a value see FUNCTION.
Example:
SUB HI
PRINT 6 * 7
END SUB
CALL HI
TYPE Point
X AS INTEGER
Y AS INTEGER
END TYPE
SUB Show(p AS Point)
PRINT p.X, p.Y
END SUB
DIM pt AS Point
pt.X = 10 : pt.Y = 20
CALL Show(pt)
Source: docs/help/sub.txt inmmcore. On the computer, typeHELP SUB.