Swift备忘录
常量
1 | let myInt = 1 |
变量
1 | var myInt = 1 |
字符串
1 | var myString = "a" |
字典
1 | var days = ["mon": "monday", "tue": "tuseday"] |
枚举
1 | enum CollisionType: Int { |
数组
1 | var colors = ["red", "blue"] |
类
1 | class Counter { |
条件判断
1 | //IF STATEMENT |
循环
1 | for var index = 1; index < 3; ++index { |
函数
1 | func iAdd(a: Int, b: Int) -> Int { |
逻辑操作
1 | var happy = true |
打印(输出)
1 | let name = "swift" |