If we want a list of all the movies in Gabe's list, we can use a for...loop. Let's see how that works:
for movie in gabesFavMovieSet { print("Gabe's movie - \(movie)") }
Your code should now look like this:
Now that we have seen a for...in loop for all three collections, that is, arrays, dictionaries, and sets, you can see that there are a lot of similarities. Remember, since sets come unordered, every time we run our for...in loop, we will get a list in a different order. The way around this is to use the sorted() method. Using sorted() will ensure that every time we loop through our list, it will always be in the same order. Let's do that with Craig's movie list:
for movie in craigsFavMovieSet.sorted() { print("Craig's movie - \(movie)") }
Your code should now look like this:
Now that we have our set sorted, let's look at the real power of using sets.