Swift 2.0 Learning Note (Day5)-Identifiers and keywords I know

Source: Internet
Author: User

Swift 2.0 Study notes (Day5 )--The identifiers and keywords I know

Original articles, welcome reprint. Reprint Please specify: Dongsheng's Blog

A lot of computer language has identifiers and keywords, has not been a good summary, it is such a use, now small to tidy up the swift identifier and keywords.

What is an identifier?

Identifiers are names specified by the developer for variables, constants, methods, functions, enumerations, structs, classes, protocols, and so on.

In fact, the letters that make up identifiers have certain specifications, and the naming rules in Swift are:

L is case-sensitive, myname and myname are two different identifiers;

L The first character of the identifier can start with an underscore (_) or a letter, but not a number;

The other characters in the L identifier can be underscores (_), letters, or numbers.

For example: UserName, user_name, _sys_val, height, and so on are legal identifiers, while 2mail, room#, and class are invalid identifiers.

What is a keyword?

A keyword is a sequence of reserved characters, similar to an identifier, that is defined by the language itself and cannot be used unless it is enclosed in an accented (') notation.

The following 4 keywords are common to swift languages.

L keywords related to declaration: class, Deinit, enum, and so on.

L keywords related to statements: Break, case, continue and so on.

L Expressions and Type keywords: as, catch, DynamicType, false, and so on.

L keywords used in specific contexts: associativity, convenience, dynamic, and so on.

The keywords in swift are case-sensitive, so class and class are different, so class is not a keyword for swift.

Welcome to follow Dongsheng Sina Weibo @tony_ Dongsheng.

Learn about the latest technical articles, books, tutorials and information on the public platform of the smart Jie classroom

More Products iOS, Cocos, mobile design courses please pay attention to the official website of Chi Jie Classroom: http://www.zhijieketang.com

Luxgen Classroom Forum Website: http://51work6.com/forum.php

Swift 2.0 Learning Note (Day5)-Identifiers and keywords I know

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.