Sub                                                                                                         Statement

 

SUB(varList)

 

Description

Define the start of a subroutine and the variables that are passed as arguments. Each variable in varList is defined as Varname AS varType where varType is the type of variable (Integer, Float, Array, UDT etc, except for the Database type). Variables are separated by commas. A SUB statement defines the start of a subroutine and the end of the subroutine is defined by the END SUB statement. As opposed to functions, a subroutine does not return a value. Results must be returned by setting the value of one or more argument variables. The execution of END SUB statement returns control to the calling program. However, an EXIT SUB statement immediately terminates the function and returns control to the calling program.

 

Example

Call CalcSub(5.0 , 50000, interest)

.......

Sub CalcSub(rate as Float, amount as Float , int as Float)

  Int=rate / 100 * amount

End Sub