[swift] 03. 제어문

for

// Dictionary key value 
let numberOfLegs = ["spider": 8, "ant": 6, "cat": 4]
for (animalName, legCount) in numberOfLegs {
  print("\(animalName)s have \(legCount) legs")
}

switch

greet(person: [“name”: “John”]) // Prints “Hello John!” // Prints “I hope the weather is nice near you.” greet(person: [“name”: “Jane”, “location”: “Cupertino”]) // Prints “Hello Jane!” // Prints “I hope the weather is nice in Cupertino.”

### 버전 확인
```swift
if #available(iOS 10, macOS 10.12, *) {
    // Use iOS 10 APIs on iOS, and use macOS 10.12 APIs on macOS
} else {
    // Fall back to earlier iOS and macOS APIs
}