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