Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


Returns the logical AND of corresponding elements of two dynamic arrays.




dynarray An expression that resolves to a dynamic array of boolean values.


The ANDS function performs a logical AND test on the corresponding element values of dynarray1 and dynarray2. If both element values are non-zero numeric values, ANDS returns 1 for that element. Otherwise, ANDS returns 0. If a dynarray element value is an empty string, a missing element, or a string containing any non-numeric character, ANDS parses its value as 0.

A single leading plus or minus sign is parsed as a numeric character. Multiple leading plus and minus signs are treated as numeric characters in a number, but not in a numeric string. A numeric string with multiple leading plus and minus signs causes ANDS to treat the element value as non-numeric.

If the two dynamic arrays have different numbers of elements, the returned dynamic array has the number of elements of the longer dynamic array. By default, the shorter dynamic array is padded with 0 value elements for the purpose of the logical comparison. You can also use the REUSE function to define behavior when specifying two dynamic arrays with different numbers of elements.

Caché MVBasic also supports the logical operators & and AND.


The following example uses the ANDS function to compare two dynamic arrays. It returns 1 when both element values are non-zero:

      ! returns 1ý0ý1ý0
Copy code to clipboard

The following example performs an AND test on two dynamic arrays of different lengths:

      ! returns 1ý0ý1ý0ý0ý0
Copy code to clipboard

See Also