Documentation (c) 2006-2008 Hobby-Robotics, LLC


Function statement

Syntax:

Function name ( argument_list ) As type

...

name = expression

[ Exit Function ]

...

End Function

Description:

Defines internal Function returning computed value of the specified type. Function can be used (called) in expression anywhere in the program using name.

When Function is called, statements between Function and End Function are executed and then computed Function value is returned.

Function body has to have at least one assignment to a Function name before exit from the Function.

If the function exits before assignment to name is made then the return value is undetermined.

Exit Function statement can be placed anywhere in the body of the Function to exit it early.

name

Identifier

argument_list

List of arguments, separated by coma ”,”

type

Type return value, can be any of the Simple Types: Boolean, SByte, Byte, Short, UShort, Integer, UInteger, Single as well as String Structure

expression

Return value expression

[ Exit Function ]

0 or 1 Exit Function statement, early exit, optional statement