Purpose
Declares a procedure as a function capable of returning a value when it is called.
The name of the function is treated as a variable from within the function and the value will be returned when the function returns. Functions can be of any type and can call other procedures and internal functions to process the result.
Syntax
Function Name (ParameterToFunction as DataType) as DataType
Example
Function MultiplyByTen(X as Integer)
as Integer
MultiplyByTen=MultiplyByTen*10
End Function
Sub Main
Print"Eight times ten is "& MultiplyByTen(8)
End Sub
|