Objective C Logical Operators - Objective C

What are Logical Operators in Objective-C?

Logical operators supported by Objective-C language are listed in below table. Assume variable A holds 1 and variable B holds 0, then:

Called Logical AND operator. If both the operands are non-zero, then condition becomes true.
(A && B) is false.
Called Logical OR Operator. If any of the two operands is non-zero, then condition becomes true.
(A || B) is true.
Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true, then Logical NOT operator will make false.
!(A && B) is true.


The following example explains the logical operators available in Objective-C programming language:

On compiling and executing the above program, the following result is produced:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Objective C Topics