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

Save for later
About this episode
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 16. Work with Sets Next episode: 18. Conclusion

This video Challenge: Play with Sets was last updated on May 3 2022

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

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a Professional subscription.

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) {