튜플은 여러값을 단일 복합 값으로 그룹화 한다.
let http404Error = (404, "Not Found")
// http404Error is of type (Int, String), and equals (404, "Not Found")
let (statusCode, statusMessage) = http404Error
print("The status code is \(statusCode)")
// Prints "The status code is 404"
print("The status message is \(statusMessage)")
// Prints "The status message is Not Found"
'Swift > Swift 기초 문법' 카테고리의 다른 글
[기초] guard let (0) | 2023.08.14 |
---|---|
[기초] 옵셔널 (Optionals) (0) | 2023.04.05 |
[기초] 클로저 (0) | 2023.03.26 |
[기초] 제네릭 (0) | 2023.03.26 |
[기초] 프로퍼티 옵저버, 함수 매개변수 이름 (0) | 2023.03.26 |