Routines (alphabetical) > Routines: C > CALL_FUNCTION

# CALL_FUNCTION

CALL_FUNCTION function calls the IDL function specified by the string Name, passing any additional parameters as its arguments.

Although not as flexible as the EXECUTE function, CALL_FUNCTION is much faster. Therefore, CALL_FUNCTION should be used in preference to EXECUTE whenever possible.

## Examples

The following command indirectly calls the IDL function SQRT (the square root function) with an argument of 4 and stores the result in the variable R:

R = CALL_FUNCTION('SQRT', 4)

## Syntax

Result = CALL_FUNCTION(Name [, P1, ..., Pn])

## Return Value

The result of the called function (specified by the string Name) is passed back as the result of this routine.

## Arguments

### Name

A string containing the name of the function to be called. This argument can be a variable, which allows the called function to be determined at runtime.

### Pi

The arguments to be passed to the function given by Name. These arguments are the positional and keyword arguments documented for the called function, and are passed to the called function exactly as if it had been called directly.

## Keywords

None.

## Version History

Pre 4.0 | Introduced

## See Also

CALL_PROCEDURE, CALL_METHOD, EXECUTE