The Swift tutorial operator

Source: Internet
Author: User
Import FOUNDATION//4, compound assignment operator var a = 1a + = 2//unary decrement operator (a numeric value before a symbol-called unary minus operator) let three = 3let Minusthree =-three//minusthree  = -3let Plusthree =-minusthree//plusthree = 3//unary plus operator (unary plus operator (+) return value, no change) let Minussix = 6let Alsominussix = +minussix Alsominussix = 6//6, ternary conditional operator//Special NOTE: three-mesh operator (?) There must be at least one space in front of let Contentheight = 40let rowHeight = contentheight + (Contentheight > 20? 50:20)//7, range operator//enclosing range operator (includes a and b) for index in 1...5 {    print ("\ (index) times 5 is \ (Index * 5)")}//semi-enclosed area operator (header not covered tail) let names = ["Anna", "Alex", "Brian "," Jack "]let count = names.countfor i in 0..<count{    print (" Person \ (i) is called \ (Names[i]) "}

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

The Swift tutorial operator

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.