OUTARGC

Purpose:

Returns the number of output arguments expected by the current multi-value assignment of an SPL function.

Syntax:

OUTARGC

Returns:

An integer.

Example:

Consider myfunction defined as follows:

 

myfunction(x)
{
    if (outargc > 1)
    {
        return(x, x * x);
    }
    else
    {
        return(x);
    }
}

 

(a,b) = myfunction(10)

 

assigns a the value 10 and b the value 100

 

a = myfunction(10)

 

only assigns a.

Remarks:

The parentheses ( )'s are required for multi-value assignments. If a function returns N values but only N-P variables are supplied on the left hand side of the assignment, the remaining return values are discarded. Likewise, if a function returns N values and N+P assignment variables are supplied, only N assignments occur. This allows multi-value functions to be more efficient by testing whether a particular return value even needs to be calculated.

 

See RETURN to return zero or more values from an SPL function.

 

See ARGCOUNT to determine the number of input arguments to an SPL function.

See Also:

ARGCOUNT

RETURN