␡
- What Is Swift?
- Getting Started
- Summary
- Q&A
- Workshop
- Exercise
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
- What command opens the Swift REPL?
- 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?
- How do you quit the Swift REPL?
- What is the minimum Mac OS X version that runs Xcode 6?
What would be the output of the following Swift code?
let age = 33 let outputString = "Someone you know is \(age) years old"
Answers
- xcrun swift.
- var result = 3 * 19 (The playground result pane displays 57.)
- Type a colon (:) then q, and then press Return.
- Mac OS X 10.9.3 is the minimum version to run Xcode 6.
- The output would be: “Someone you know is 33 years old”.