Function <Function Name> ( Param1, Param2, ... )

Return <Value>

Online IVR Tutorial

Identifies the start of a user-defined function.
<Function Name> Name of the function.

Param1, Param2, ... Parameters passed to the function and should be separated by commas.

<statements> One or more executable statements inside the function definition.

<expression> Expression which supports variables or value.

Return Value Remarks  


1. Calling a function within the same script:

The above function AddNum adds up the variables $Num1 and $Num2 and the resulting value $Num3 is returned.

AddNum can be beckoned in the script as:

$Num4 = AddNum ($Num1, $Num2)

* In the later case the returned value is assigned to the variable $Num4.
* By giving values 2, 4 respectively to $Num1 and $Num2, the value of $Num3 or $Num4 would be 6.

If this function is not found in the script file then ivr searches for it in the precedence order as given in the remarks section.

2. Calling another .dt or .dtx file just like a plugin: Content of script file "MathOperation.dt":

Content of file "Addition.dt"
3. Recursive functions