Programming in Dart: Control Flow & Collections

May 3 2022 · Dart 2.15, DartPad, DartPad

Part 2: More Collections

17. Challenge: Play with Sets

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 16. Work with Sets Next episode: 18. Conclusion

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

Camera 1

Now to dive into the last challenge for this course. This challenge is going to read like a math problem, so buckle up and hold on. Raunaq, Jean, Eric, Yogesh and Sally took a plane trip to Osaka. Raunaq and Eric had the vegetarian dinner. They rest had the fish dinner. Unfortunately, the fish was bad and made everyone sick. Using a set, print out the people who at the fish. Pause the video now and try it out.

var passengers = { 'Raunaq', 'Jean', 'Eric', 'Yogesh', 'Sally'};
var veggie = { 'Raunaq', 'Eric' };
var sickPassengers = passengers.difference(veggie);
for (var passenger in sickPassengers) {
    print(passenger);
}