Objective-c中使用字面量语法

字面量数值的用法如下

NSNumber *intNumber = @1
NSNumber *doubleNumber = @3.1454333
NSNumber *booleanNumber = @YES
NSNumber *charNumber = @'a'

字面量数组用法
NSArray *array = @{@”a”,@”b”}
字面字典用法
NSDictionary *dic =
@{@”name”:@”aaaa”,
@”age”:@1}
字面量用法很简单,而且这样很安全,如果数据出现问题一眼就能看出来哪里出了问题,哪里的数据不对

0 0 vote
Article Rating
Subscribe
提醒
guest
0 评论
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x