How to make AND or OR expressions?

I wrote this:

if( a == -11 && b == -1 ){ { if( a == -1) AND ( b == -1)... 

But it does not work, and I have the same problem with OR . How to write expressions containing OR or AND ?

+6
source share
3 answers

You use && for "and" and || for "or."

+19
source

(a == -11 && b == -1) excellent and correct. Objective-C uses the same logical operators as C. || - logical or operator.

+6
source
 if (a==-11 && b==-1) { 

if it is completely legal in C, and therefore Objective-C.

The second example is not C or Objective-C

+4
source

Source: https://habr.com/ru/post/888964/


All Articles