Articles for their own study, the department is reproduced. Notes for learning 51cto courses. If there is infringement, please private messages I delete.
The links are as follows.
? http://edu.51cto.com/roadmap/view/id-58.html
1. Definition of tuple constants/variables
2. Extract each meta-value from the tuple data
3. Name each element in the tuple data
1 let Product1 = (20 , " iphone6 " , 5888 ); 2 let product_name = " iphone7 3 var product2 = (30 , " \ (product_name) , 18888 ); 4 println (Product1); 5 println (product2);
1 Let (id1, name1, Price1) = product2 // 3 values are given to these three constants respectively 2 println ( " id1=\ (ID1), name1=\ (name1), price1=\ (Price1) " 3 4 Let (_, name2, _) = Product1 // Only the name variable is required, and the other is represented by a glide line 5 println ( name2=\ (name2) );
1 Let product3 = (+, Name:"iPhone8", Price:5988) 23println (product3.name); 4 println (Product3.price);
swift--tuple data type (tuples)