- Write custom methods to solve a few simple problems.
- Call your methods to get the results that you need.
- Run the tests to check your work.
You did such a great job last year at the Apple Worldwide Developers Conference that they've asked for you back—and now they want you to handle a few more tasks as well. It's more work than you could possible handle by yourself given the time frame, so you'll need to figure out how to pass off the instructions by creating some methods!
The speaker list is new this year, but it boasts a similarly astounding group.
- Adele Goldberg
- Edsger Dijkstra
- Joan Clarke
- Clarence Ellis
- Margaret Hamilton
- George Boole
- Tim Berners-Lee
- Jean Bartik
In addition to the name tags, the conference manager also wants you to print a personalized greeting for each speaker to inform each of them of their dressing room assignment back stage.
- Navigate to the
AppDelegate
file. Declare three functions:
badgeForSpeaker()
that accepts oneString
argument namedspeaker
and returns anString
badgesForSpeakers()
that accepts oneArray
of strings argument namedspeakers
and returns anArray
of stringsgreetingsAndRoomAssignmentsForSpeakers()
that accepts oneArray
of strings argument namedspeakers
and returns anArray
of strings
-
Define
badgeForSpeaker(_:)
to return an interpolated string that includes the speaker's name submitted through the argument, in the manner ofHello, my name is <#speaker#>.
. -
Define
badgesForSpeakers(_:)
to return an array of eight (8) interpolated strings that each readHello, my name is <#speaker#>.
, one string for each speaker that will be at the conference. -
Define the
greetingsAndRoomAssignmentsForSpeakers(_:)
method to iterate over thespeakers
argument array and create an interpolated string with each speaker's name and their dressing room number (which range from 1 through 8). The interpolated string should read:Welcome, <#speaker#>! You'll be in dressing room <#roomNumber#>.
View WWDC Badges With Methods on Learn.co and start learning to code for free.
View WWDC Badges With Methods on Learn.co and start learning to code for free.