Cicode Programming Reference > Writing Functions > Declaring Argument Data Type

Declaring Argument Data Type

If an argument is listed in a Cicode function declaration, the Argument Data Type Statement is required, and is listed first before the required Argument Name Statement and the optional Argument Initialisation Statement.

The argument data type of a function can be only one of six possible data types: INT (32 bits), REAL (32 bits), STRING (255 bytes), OBJECT (32 bits), QUALITY or TIMESTAMP (64 bits).

INT, REAL, STRING, OBJECT, QUALITY and TIMESTAMP are Cicode keywords and as such, are reserved.

Note: In the following function syntax example:
- Every placeholder shown inside arrow brackets ( <placeholder> ) should be replaced in any actual code with the value of the item that it describes. The arrow brackets and the word they contain should not be included in the statement, and are shown here only for your information.
- Statements shown between square brackets ( [ ] ) are optional. The square brackets should not be included in the statement, and are shown here only for your information.

To declare the argument data type that will be used in the function, you need to prefix the Argument Name Statement with one of the Cicode data type keywords, in the <ArgumentDataType> placeholder in the following example.

FUNCTION
FunctionName ( <ArgumentDataType> <ArgumentName> [ = <InitialDefaultValue> ] )
<Statement> ;
<Statement> ;
<Statement> ;
END

The Argument Statement in a Cicode function needs to have only one set of surrounding parentheses ( ) brackets, even if no arguments are declared in the function.

If more than one argument is used in the function, each needs to also be separated by a comma.

Argument Statements can be separated over several lines to aid in their readability.