Swift overview and Swift operators and expressions

Source: Internet
Author: User

Swift is a new language used to design iOS and Mac OS X applications.

Swift features

? Swift retains the advantages of C and Objective-C and abandons the limitations it imposes to be compatible with the C language.

? Swift incorporates the security programming model and adds some modern features to make it easier to use, more flexible, and more fun.

? The combination of Swift's simple and clean style and popular box-ready Cocoa/Cocoa Touch will bring new opportunities for the new software development process.

? Swift memory management adopts the ARC style.

Swift code file extension *. swift

Operator

? Arithmetic Operators, +,-, *,/, %,

++ ,--

? Relational operators,>, <, >=, <=, = ,! =

? Boolean logical operator ,! , &, |

? Ternary operator ,? :

Expression

1. do not specify the Data Type

Var a1 = 10 var a2 = 20

Var a = a1> a2? "A1": "a2"

2. Specify the Data Type

Var a1: Int = 10 var a2: Int = 20

Var a = a1> a2? "A1": "a2"

3. You can end with a semicolon.

Var a1: Int = 10; var a2: Int = 20 var a = a1> a2? "A1": "a2"

Note

//

/**/

Swift discussion forum: http://www.cocoagame.net
Welcome to the Swift technology exchange group: 362298485

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.