setDifference

setDifference(set1, set2)

Try it yourself:


Remove set members with setDifference

setDifference(A, B) returns members in A that are not in B. It is useful for exclusions, permission gaps, and comparing lists after deduplication.

Example

With A = {1,2,3} and B = {2,4}, the difference is {1,3}. The operation is directional: reversing inputs changes the result. Compare setSymDifference for members unique to either set and setIntersect for shared members.

Input notes

Set equality rules determine whether two values match. Use setDistinct when source collections contain duplicates and setIsSubset to test containment rather than construct a result.

All functions