Coder Social home page Coder Social logo

wwdc-badges-001-prework-ios's Introduction

WWDC Badges

Objectives

  1. Create an array containing string objects.
  2. Iterate over an array with a for loop.
  3. Access an array's elements with subscripting syntax.
  4. Use an array's elements to print a dynamically interpolated string to the console.

Introduction

You're helping out at Apple's Worldwide Developers Conference this year. Your task is to print badges for each of the eight keynote speakers. Each speaker's badge needs to say, "Hello, my name is <#name#>." with the <#name#> field filled with that speaker's name.

This is not a code-along. You will need to solve this lab yourself by incorporated various elements from previous lessons to get the correct printout in your debug console.

Instructions

Fork and clone this lab. Open the wwdc-badges.xcodeproj file and navigate to the FISAppDelegate.m implementation file. Write your code in the application:didFinishLaunchingWithOptions: method.

  1. Create an NSArray object named conferenceSpeakers to store the list of speaker names as strings:

That's quite a lineup!

  1. Iterate over the conferenceSpeakers array using a for loop. (Remember, arrays begin at index 0!) Use string interpolation with an NSLog()inside the loop to print "Hello, my name is <#name#>." for each speaker's name in the array.

  2. Run (โŒ˜+R) the application. You should see the following lines print out in the debug console.

Hello, my name is Anita Borg.
Hello, my name is Alan Kay.
Hello, my name is Ada Lovelace.
Hello, my name is Aaron Swartz.
Hello, my name is Alan Turing.
Hello, my name is Michael Faraday.
Hello, my name is Grace Hopper.
Hello, my name is Charles Babbage.

It's too bad that Inigo Montoya was already booked.

Advanced

Instead of using a single array for names, split the names into two separate arrays for first name and last name. Alter your NSLog() to take two format arguments, one from each array: Hello, my name is <#firstName#> <#lastName#>.. You should get an equivalent result to the one shown above.

wwdc-badges-001-prework-ios's People

Contributors

markedwardmurray avatar chrisgonzgonz avatar fs-lms-test-bot avatar cordavi avatar jmburges avatar sarogers avatar fislabstest avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.