toggle(value)

Toggles the existence of a value in a set.

If the value exists, deletes it. if the value does not exist, adds it.

On collections

Usage

  • toggle(value)

Related

  • add(value)

    Adds a value to a collection.

  • delete(value)

    Deletes the first equivalent value. Returns whether the key was found and successfully deleted.