Removes Items From Array In Other Arrays | ARRAY_DIFFERENCE

Syntax

ARRAY_DIFFERENCE( first, [...values] )

Parameters

first
The value the difference will be computed from.

values
Any number of ARRAY values whose items will be removed from FIRST.

Return Value

An ARRAY containing all the items in FIRST that are not in any of the VALUES.

Description

Compute the difference of a an ARRAY with other ARRAYS. Equality of ARRAY and MAP values are performed structurally as is done with the EQUAL operation.

Examples

ARRAY_DIFFERENCE([1, 2, 3]) # returns [1, 2, 3]
ARRAY_DIFFERENCE() # returns []
ARRAY_DIFFERENCE([1, 2, 3], [2, 3, 4]) # returns [1]
ARRAY_DIFFERENCE([[1, 2], [3, 4]], [[1, 2], [4, 5]]) # returns [[3, 4]]
ARRAY_DIFFERENCE([1, 2], [2, 3], [1, 4], [4, 5], [7]) # returns []