I apologize if this is widely known or trivial. But since it took me several days to figure out… To remove all elements from a slice, you can use
$mySlice = first 0 $mySlice
Assigning to it like this
$mySlice = slice
does not work, although
$mySlice := slice creates an empty slice. If there’s another obvious way to achieve this, I’d be glad to hear about it.
Background: I needed slices to collect information about subgroups in a taxonomy term and output at the end of the subgroup’s listings. After each subgroup, the slices had to be cleared for the next one.