max*_*ax_ 3 boolean objective-c
在objective-c中,如果我想反转a的值,这BOOL会工作,还是会设置BOOLto 的值NO?
BOOL ab = YES;
ab = !ab; // would this reverse the BOOL, ab, and set it to NO?
if (ab == NO) {
ab = !ab; // would this reverse the BOOL again and set it to YES?
}
Run Code Online (Sandbox Code Playgroud)
是的,那会有效.BOOL只是一个整数.YES是1和NO是0.!1 == 0和!0 == 1.
| 归档时间: |
|
| 查看次数: |
4770 次 |
| 最近记录: |