August 2016
Intermediate to advanced
1027 pages
23h 11m
English
Let's take a look at what this looks like in practice. We can use some of the techniques we learned in this chapter to write a different and possibly better implementation of our party inviter.
We can start by defining the same input data:
//: List of people to invite
let invitees = [
"Sarah",
"Jamison",
"Marcos",
"Roana",
"Neena",
]
//: Dictionary of shows organized by genre
var showsByGenre = [
"Comedy": "Modern Family",
"Drama": "Breaking Bad",
"Variety": "The Colbert Report",
]In this implementation, we are making the invitees list, which is just a constant list of names and the shows by genre dictionary variable. This is because we are going to be mapping our invitees list to a list of invitation text. As we do the mapping, we will ...
Read now
Unlock full access