Caché Basic Reference
Call
[Home]  [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Transfers control to a Sub procedure or Function procedure.
Synopsis
[Call] name([arglist])
Arguments
The Call statement syntax has these parts:
Call Call is an optional keyword. If specified, you must enclose arglist in parentheses. For example: Call MyProc(0)
name Name of the procedure to call. To call a procedure in an external routine, specify name@routine(arglist).
arglist Optional — Comma-delimited list of variables, arrays, or expressions to pass to the procedure. The parentheses are required, even when there are no arguments.
Description
You are not required to use the Call keyword when calling a procedure. However, if you use the Call keyword to call a procedure that requires arguments, argumentlist must be enclosed in parentheses. If you omit the Call keyword, you also must omit the parentheses around arglist. If you use either Call syntax to call any intrinsic or user-defined function, the function's return value is discarded.
To omit an arglist argument value, you must specify an undefined variable. This is a significant difference between ObjectScript and Caché Basic. In ObjectScript an omitted argument can be specified using a placeholder comma. In Caché Basic you cannot use a placeholder comma; you must supply an undefined named variable.
Examples
The following example shows how to use the Call statement:
Call MyFunction("Hello World")

Function MyFunction(text)
  Println text
End Function