
说IT
用代码摇滚这个世界
一个关注技术与人文的IT博客
1 2 3 4 5 6 7 8 9 10 11 12
| 一般写法: float tempOffset = wordsDisplay == DisPlayBottom ? -80 : 80;
优质写法:
float offset = (DisPlayBottom == wordsDisplay) ? - 80 : 80;
遵循常量放左边的原则
三目运算也可以这么写: NSString *filetestpaht; filetestpaht = filetestpaht ? : [NSString stringWithFormat:@"abc"];
|
本文代表个人观点,内容仅供参考。若有不恰当之处,望不吝赐教!