Return Statement of a Function Object

The Return statement passes a value back to the function that called it.

Format

return value

The following table describes the arguments for the Return statement.

Argument Description

value

Contains a value from the function that calls the Return statement.

Usage

Siebel CRM does not run any code in a function that occurs after a Return statement.

If you define a return type for a custom function, then you must explicitly return a value of the same type that the function header specifies. All control paths must lead to a Return statement.

Example 1

The function in the following example returns a value that is equal to the number that Siebel CRM passes to it multiplied by 2, and then divided by 5:

function DoubleAndDivideBy5(a)
{
   return (a*2)/5 
}

The following example does the following work:

n = (10 * 2) / 5 + (20 * 2) / 5

  • Displays the value for n, which is 12:

function myFunction()
{
   var a = DoubleAndDivideBy5(10);
   var b = DoubleAndDivideBy5(20);
   TheApplication().RaiseErrorText(a + b);
}