|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:
a=1:@VM:0:@VM:33:@VM:0 b=10:@VM:9:@VM:1:@VM:0 PRINT ANDS(a,b) ! returns 1ý0ý1ý0
The following example performs an AND test on two dynamic arrays of different lengths:
a=1:@VM:0:@VM:1:@VM:0 b=1:@VM:1:@VM:1:@VM:1:@VM:1:@VM:0 PRINT ANDS(a,b) ! returns 1ý0ý1ý0ý0ý0