Swift Set removeAll()

The removeAll() method removes all the elements from the set.

Example


removeAll() Syntax

The syntax of the removeAll() method is:

set.removeAll()

Here, set is an object of the Set class.


removeAll() Parameters

The removeAll() method doesn't take any parameter.


removeAll() Return Value

The removeAll() method doesn't return any value. It only removes elements from the set.


Example: Swift Set removeAll()

Output

Programming Languages: ["Java", "Swift", "C"]
Set after removeAll: []