用类比的方式去学习编程!
Component | Objective - C | Swift | Java | Python | Go | Ruby |
---|---|---|---|---|---|---|
字符串 | NSString | String | String | String | ||
整型 | NSInteger | Int | int | |||
单精度浮点型 | CGFloat | Float | float | |||
双精度浮点型 | double | Double | double | |||
布尔类型 | BOOL | Bool | boolean | |||
数组 | NSArray | Array | array | list | ||
字典 | NSDictionary | Dictionary | dict | |||
集合 | NSSet | Set | ||||
for 循环 | for | for | for | for | ||
while 循环 | while | while | while | while | ||
枚举 | NS_ENUM | enum | enum | |||
元组 | - | Tuple | tuple | |||
函数 | Function | func | function | |||
协议 | @protocol | protocol | interface | |||
结构体 | - | struct | ||||
类 | @interface | class | class | class | ||
if 分支 | if | if else | if | if_elif_else | ||
switch 分支 | switch | switch case | switch |