cor()

Read(1955) Label: sequence, logical or, boolean value,

Description:

Perform logical OR operation over members of a sequence.

Syntax:

A.cor(x)

 

cor(x1,…,xn)

Equivalent to A.cor(), where x1,…,xn are members of sequence A

Note:

The logical OR operation. The function returns true when at least one member of sequence A is true; otherwise, it returns false.

 

Operators in a logical operation is Boolean type; will automatically convert to Boolean type if they are not.

Parameter:

A

A sequence

x

An expression; cannot be omitted when sequence A is a table sequence or a record sequence

Return value:

Boolean

Example:

When A is a sequence:

 

A

 

1

=[2<10,3>4,1!=1]

Return members true, false, false.

2

=A1.cor()

true.

3

=[1!=1,3<2].cor()

false.

4

=[20,1>2].cor()

true; automatically convert to Boolean when members of the sequence are non-Boolean type.

5

=[null,1<2].cor()

true.

6

=cor(20,1>2)

True, which is same as A4.

When A is a table sequence or a record sequence:

 

A

 

1

=demo.query("select top 10 EID,NAME,GENDER,DEPT from EMPLOYEE")

2

=A1.cor(DEPT=="HR")

Judge whether there is a record whose DEPT value is HR in table sequence A1 and return true.