Definition of Return Variables
- Updated2025-10-31
- 2 minute(s) read
Definition of Return Variables
Functions can have none, one, or multiple return variables.
- Return values are used in the function like variables.
- Return values are pre-initialized to 0 or "".
- When the function ends, the current values of the return variable is returned to the caller.
No Return Variable
If the function has no return variable it is defined as follows:
function function name (type Parameter1, ..., type Parameter_n) // implementation code endfunction
Example

One Return Variable
If the function has one return variable it is defined as follows:
function type return variable = function name
(type Parameter1, ..., type Parameter_n)
// implementation code
endfunction
Example

Multiple Return Variables
If the function has multiple return variables they are defined in brackets [].
The content of the [ ] defines the return tuple.
function [ type return variable_1,, ... , data type return variable_n] =
function name (type parameter1, ..., type parameter_n)
// implementation code
endfunction
Example
