Start the Swift learning path

Source: Internet
Author: User

Swift has been out for months and has not really cared about swift, apart from sharing a bit of knowledge with colleagues. The learning of SWIFT data compiled on GitHub is still good, and is now available in E-book and PDF format.

Swift's syntax is still very different from the language syntax we normally develop, and Swift does not need to be written; The Terminator, the variable declaration, can be used without specifying the type. It's pretty cool to see the code effects written immediately below the playground.

Due to the limited time of the day, only a little slowly understand.

var and let

Both are declared variables, but let's declare a variable that can only be assigned once, like our const.

If Else

1 if {    println ("YES")}

If the contents of the content must be Boolean expressions , we develop a language that basically supports the IF TMP {...}, but Swift does not support, if this write will be an error. The curly braces that follow the If are also required.

Optional values

"  A " if optional = = Nil {    println ("YES"else  {    println ("NO")}

An optional value indicates that the variable has a specific value or nil. What if you don't add it back? Indicates an optional, the above code will be an error. It may be that Swift has done the next processing of nil, possibly to achieve the corresponding protocol;

Start the Swift learning path

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.