ORS
Synopsis
ORS(dynarray1,dynarray2)
Arguments
dynarray | An expression that resolves to a dynamic array of boolean values. |
Description
The ORS function performs a logical OR test on the corresponding element values of dynarray1 and dynarray2. If either element value is a non-zero numeric value, ORS returns 1 for that element. Otherwise, ORS returns 0. If an element value is missing, a null string, or a string containing any non-numeric value, ORS parses its value as 0.
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 OR.
Examples
The following example uses the ORS function to compare two dynamic arrays. It returns 1 when either element value is non-zero:
a=1:@VM:0:@VM:33:@VM:0
b=10:@VM:9:@VM:1:@VM:0
PRINT ORS(a,b)
! returns 1ý1ý1ý0
The following example performs an OR 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ý1ý1ý1ý1ý0