Skip to content

all, any

all

Everything is true

Syntax: all x, all[x]

Returns a boolean atom 1b if all items of x are non-zero, and otherwise 0b.

It applies to all data types except symbol, first converting the type to boolean if necessary.

all is an aggregate function.

q)all 1 2 3=1 2 4
q)all 1 2 3=1 2 3
q)if[all x in y;....]   / use in control structure

any

At least something is true

Syntax: any x, any[x]

Returns a boolean atom 1b if any item of x is non-zero, and otherwise 0b. Applies to all data types except symbol, first converting the type to boolean if necessary.

any is an aggregate function.

q)any 1 2 3=10 20 4
0b
q)any 1 2 3=1 20 30
1b
q)if[any x in y;....]   / use in control structure

& and, | or, max, min
Basics: Logic