Swift基礎編——元祖

2564 ワード

元祖
import UIKit

//   
/*:
  
*       
*                ()       
*   :          C OC                          ,                       
*/
let student = ("hello", 99, 99.8)
print(student)
print(student.0)
print(student.1)
print(student.2)

/*:
*           ,            .                  ?
*          ,            
*/
let student1: (String, Int, Double) = ("hello", 99, 99.8)

/*:
         :           
*/
let student2 = (name:"hello",age:99,score:99.8)
print(student2.name)
print(student2.age)
print(student2.score)

/*:
         :
*                ,                    
*/
let (name , age , score) =  ("hello", 99, 99.8)
print(name)
print(age)
print(score)

/*:
                _        
*/
let (name1 , age1 , _) =  ("hello", 99, 99.8)
print(name1)
print(age1)