# setDifference() Function & Examples

Use the setDifference() set function in Calcul.io. Review its syntax, edit working examples, understand the result, and explore related math functions.

## setDifference

#### setDifference(set1, set2)

Try it yourself:

```calculio
setDifference([1, 2, 3, 4], [3, 4, 5, 6])
setDifference([[1, 2], [3, 4]], [[3, 4], [5, 6]])
```

---

## 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](https://calcul.io/function/setSymDifference/index.md) for members unique to either set and [setIntersect](https://calcul.io/function/setIntersect/index.md) for shared members.

## Input notes

Set equality rules determine whether two values match. Use [setDistinct](https://calcul.io/function/setDistinct/index.md) when source collections contain duplicates and [setIsSubset](https://calcul.io/function/setIsSubset/index.md) to test containment rather than construct a result.

[All functions](https://calcul.io/functions/index.md)
