Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book

Workshop

The workshop contains quiz questions and exercises to help you solidify your understanding of the material covered. Try to answer all questions before looking at the answers that follow.

Quiz

  1. What command opens the Swift REPL?
  2. Use a playground to write Swift code that multiplies the numbers 3 and 19 and stores the value in a variable named result. What does the code look like?
  3. How do you quit the Swift REPL?
  4. What is the minimum Mac OS X version that runs Xcode 6?
  5. What would be the output of the following Swift code?

    let age = 33
    let outputString = "Someone you know is \(age) years old"

Answers

  1. xcrun swift.
  2. var result = 3 * 19 (The playground result pane displays 57.)
  3. Type a colon (:) then q, and then press Return.
  4. Mac OS X 10.9.3 is the minimum version to run Xcode 6.
  5. The output would be: “Someone you know is 33 years old”.
  • + Share This
  • 🔖 Save To Your Account