Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了这个:
if( a == -11 && b == -1 ){ { if( a == -1) AND ( b == -1)...
但两者都不起作用,我也有同样的问题OR。如何编写包含ORor的表达式AND?
OR
AND
您使用&&“and”和||“or”。
&&
||
(a == -11 && b == -1)很好而且正确。Objective-C 使用所有与 C 相同的逻辑运算符。||是逻辑或运算符。
(a == -11 && b == -1)
if (a==-11 && b==-1) {
如果在 C 中完全合法,因此在 Objective-C 中。
您的第二个示例不是 C 或 Objective-C