swift--tuple data type (tuples)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.