Mwnci intersect() Function

Syntax

intersect(array, array)

Description

The intersect() function returns an array that contains the items that exist in both array x, and array y.

It is possible to get the intersection of more than 2 arrays by intersecting intersects, as shown below:

Example

x=["car", "boat", "lorry"]
y=["train", "van", "boat"]
z=["boat", "go-kart", "bus"]

a=intersect(x,y)
b=intersect(intersect(x,y), z)

println("a=", a)
println("b=", b)


a=["boat"]
b=["boat"]