Changes

Jump to: navigation, search

Objective-C Operators and Expressions

22 bytes added, 15:09, 18 November 2009
no edit summary
</pre>
In the following next example, however, the value of x (9) is assigned to variable y ''before'' the decrement is performed. After the expression is evaluated the value of y will be 9 and the value of x will be 8.
<pre>
== Comparison Operators ==
In addition to mathematical and assignment operators, Objective-C also includes set of logical operators useful for performing comparisons. These operators all return a Boolean (''BOOL'') ''true'' (1) or ''false'' (0) result depending on the result of the comparison. These operators are ''binaryoperators'' in that they work with two operands.
Comparison operators are most frequently used in constructing program flow controllogic. For example an ''if'' statement may be constructed based on whether one value matches another:
<pre>
=== Bitwise XOR ===
The bitwise XOR (commonly referred to as ''exclusive OR'' and represent represented by the caret '^' character) performs a similar task to the OR operation except that a 1 is placed in the result if one or other corresponding bit positions in the two numbers is 1. If both positions are a 1 or a 0 then the corresponding bit in the result is set to a 0. For example:
<tt>10101011 XOR</tt><br>

Navigation menu