Removing items in a set

We can remove a single item or all the items in a set. To remove a single item, we would use the remove(_:) method and, to remove all the items, we would use the removeAll() method. The following example shows how to remove items from a set:

//The remove method will return and remove an item from a set  
var item = mySet.remove("Two") 
 
//The removeAll method will remove all items from a set  
mySet.removeAll() 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset