Many data types have functions that you can call to perform an action on a variable.

Type functions have mandatory transfer parameters and return values. In addition, many type functions also offer call variants with optional parameters.

Use the : operator to indicate functions.

variable:function ()

Optional Parameters

Some type functions require a certain set of transfer parameters. For other type functions, some or all transfer parameters are optional.

Similarly, you must query certain return values for some type functions. For other type functions, some or all return parameters are optional. In this case, you can query the return parameters. However, the return parameters do not have to be determined.

Optional transfer and return parameters are enclosed in square brackets in this manual for identification purposes.

variable:function (datatype mandatoryParameter[, datatype optionalParameter])
datatype mandatoryReturn[, datatype optionalReturn] = variable: function ()

Optional Transfer Parameters

To omit optional transfer parameters, omit the leading comma before this parameter.

Example

int32 position = text:find( text pattern[, int32 startposition])

In this example, specifying the start position is optional. The example has two call variants for this function.

int32 position    =  text:find (text pattern, int32 startposition)
int32position    = text:find (textpattern)

Optional Return Parameters

For optional return parameters, omit the leading comma if these parameters are not queried.

In addition, verify whether the return value changes between a single value and a tuple. To do so, query or omit an optional parameter. Set or omit the square brackets for the tuple return.

Example

[text convertedText [, int32 status] ]= text:convert(text codepage)

In this example, querying the status information is optional. The example has two call variants for this function.

[text convertedText, int32 status]    = text:convert(textcodepage)
textconvertedText    = text:convert(textcodepage)