Previous Topic Next topic Print topic


PROD Function

Purpose

Returns the product of all the elements of an array.

Syntax

PROD(x)

Parameters

x is an array expression.

Description

The PROD function returns the product of all the elements of the array.

If the elements of x are strings, they are converted to fixed-point values. If they are neither fixed-point values nor strings, they are converted to floating-point values. In the latter case, the result is a floating-point value; otherwise, it is a fixed-point value.

Examples

DECLARE (A(4), I) FIXED BIN (15);

DO I = 1 to 4;
   A(I) = I;
END

I = PROD(A);       /* returns 24 */

Restrictions

None.

Previous Topic Next topic Print topic