zoukankan      html  css  js  c++  java
  • Swift的关键字

    在声明中使用关键字

     let   :声明一个常量

    var  :声明一个变量

    class  :声明一个类

    static  :静态的

    deinit  :反初始化方法?析构方法

    init  :构造方法?初始化方法

    enum  :枚举

    extension  :扩展---给对象增加方法

    func  :声明一个函数

    import  :导入头文件

    internal  :内部的

    private  :私有的

    public  :公开的

    operator  :自定义运算符

    protocol  :协议

    struct  :结构体

    subscript  :下标

    typealias  :重命名某方法    typealias Feet = Int

    在语句中使用关键词

    break  :打断

    case   :条件

    continue  :跳过

    default  :默认

    do  :做什么例如 do...while

    repeat :同上 repeat...while

    if   :条件判断

    else   :条件判断

    else if   :条件判断

    switch   :条件选择

    fallthrough   :语句跳转 用在switch中跳转执行某段代码有fallthrough的代码都要并且跳转到default

    for   :循环

    for in   :循环

    while   :循环

    where  :接在case后判断执行       case let (x, y) where x == y:

    在表达式和类型中使用关键字

    as dynamicType false is
    nil self Self super
    true _COLUMN_ _FILE_ _FUNCTION_
    _LINE_
     
     
     

    在特定情况下使用的关键字

    associativity convenience dynamic didSet
    final get infix inout
    lazy left mutating none
    nonmutating optional override postfix
    precedence prefix Protocol required
    right set Type unowned
    weak willSet  
  • 相关阅读:
    [tarjan][树上差分] Codeforces 555E Case of Computer Network
    [线段树] Jzoj P1214 项链工厂
    [矩阵乘法] Jzoj P2288 沼泽鳄鱼
    [状压dp][dfs] Jzoj P2679 跨时代
    [spfa][差分约束] Bzoj 2330 糖果
    [spfa] Bzoj 2118 墨墨的等式
    [倍增][Floyd] Bzoj 2165 大楼
    [虚树][树形dp] Bzoj P3611 大工程
    [虚树][树形dp] Bzoj P2286 消耗战
    [数位dp] Jzoj P3316 非回文数字
  • 原文地址:https://www.cnblogs.com/liuShanPei1024/p/5348490.html
Copyright © 2011-2022 走看看