collections.SymDiff
Returns a slice containing the symmetric difference of two given slices.
- Syntax
- collections.SymDiff SLICE1 SLICE2
- Returns
- []any
- Alias
- symdiff
Usage
The collections.SymDiff function returns a slice containing the symmetric difference of two given slices. The symmetric difference contains the elements that appear in either slice, but not in both. The function does not sort the returned slice.
Examples
{{ collections.SymDiff (slice 1 2 3) (slice 3 4) }} → [4 1 2]Using a chained pipeline:
{{ slice 1 2 3 | collections.SymDiff (slice 3 4) }} → [1 2 4]Last updated:
November 24, 2026
:
content: Apply style guide to collections functions (04f2e2939)
Improve this page