Objective-C supports the following compound assignment operators:
 
Objective-C supports the following compound assignment operators:
   −
Operator Description
  −
x += y Add x to y and place result in x
  −
x -= y Subtract y from x and place result in x
  −
x *= y Multiply x by y and place result in x
  −
x /= y Divide x by y and place result in x
  −
x %= y Perform Modulo on x and y and place result in x
  −
x &= y Assign to x the result of logical AND operation on x and y
  −
x |= y Assign to x the result of logical OR operation on x and y
  −
x ^= y Assign to x the result of logical Exclusive OR on x and y
      +
<table border="1" cellspacing="0">
 +
<tr style="background:#efefef;">
 +
<th>Operator</th><th>Description</th>
 +
<tr>
 +
<td>x += y<td>Add x to y and place result in x</td>
 +
<tr>
 +
<td>x -= y<td>Subtract y from x and place result in x</td>
 +
<tr>
 +
<td>x *= y<td>Multiply x by y and place result in x</td>
 +
<tr>
 +
<td>x /= y<td>Divide x by y and place result in x</td>
 +
<tr>
 +
<td>x %= y<td>Perform Modulo on x and y and place result in x</td>
 +
<tr>
 +
<td>x &= y<td>Assign to x the result of logical AND operation on x and y</td>
 +
<tr>
 +
<td>x |= y<td>Assign to x the result of logical OR operation on x and y</td>
 +
<tr>
 +
<td>x ^= y<td>Assign to x the result of logical Exclusive OR on x and y</td>
 +
</table>
    
Another useful shortcut can be achieved using the Objective-C increment and decrement operators (also referred to as unary operators because they operate on a single operand). As with the compound assignment operators described in the previous section, consider the following Objective-C code fragment:
 
Another useful shortcut can be achieved using the Objective-C increment and decrement operators (also referred to as unary operators because they operate on a single operand). As with the compound assignment operators described in the previous section, consider the following Objective-C code fragment:
 
Clearly 10 is less than 20, resulting in a true evaluation of the x < y expression. The following table lists the full set of Objective-C comparison operators:
 
Clearly 10 is less than 20, resulting in a true evaluation of the x < y expression. The following table lists the full set of Objective-C comparison operators:
   Exception encountered, of type "Error"
[ea39ba7f] /index.php?title=The_Basics_of_Objective-C_Programming&diff=9142&oldid=9141 Error from line 434 of /var/www/techotopia/includes/diff/DairikiDiff.php: Call to undefined function each()
Backtrace:
#0 /var/www/techotopia/includes/diff/DairikiDiff.php(544): DiffEngine->diag()
#1 /var/www/techotopia/includes/diff/DairikiDiff.php(344): DiffEngine->compareSeq()
#2 /var/www/techotopia/includes/diff/DairikiDiff.php(227): DiffEngine->diffLocal()
#3 /var/www/techotopia/includes/diff/DairikiDiff.php(721): DiffEngine->diff()
#4 /var/www/techotopia/includes/diff/DairikiDiff.php(859): Diff->__construct()
#5 /var/www/techotopia/includes/diff/DairikiDiff.php(980): MappedDiff->__construct()
#6 /var/www/techotopia/includes/diff/TableDiffFormatter.php(194): WordLevelDiff->__construct()
#7 /var/www/techotopia/includes/diff/DiffFormatter.php(140): TableDiffFormatter->changed()
#8 /var/www/techotopia/includes/diff/DiffFormatter.php(82): DiffFormatter->block()
#9 /var/www/techotopia/includes/diff/DifferenceEngine.php(881): DiffFormatter->format()
#10 /var/www/techotopia/includes/diff/DifferenceEngine.php(797): DifferenceEngine->generateTextDiffBody()
#11 /var/www/techotopia/includes/diff/DifferenceEngine.php(728): DifferenceEngine->generateContentDiffBody()
#12 /var/www/techotopia/includes/diff/DifferenceEngine.php(662): DifferenceEngine->getDiffBody()
#13 /var/www/techotopia/includes/diff/DifferenceEngine.php(632): DifferenceEngine->getDiff()
#14 /var/www/techotopia/includes/diff/DifferenceEngine.php(453): DifferenceEngine->showDiff()
#15 /var/www/techotopia/includes/page/Article.php(797): DifferenceEngine->showDiffPage()
#16 /var/www/techotopia/includes/page/Article.php(508): Article->showDiffPage()
#17 /var/www/techotopia/includes/actions/ViewAction.php(44): Article->view()
#18 /var/www/techotopia/includes/MediaWiki.php(490): ViewAction->show()
#19 /var/www/techotopia/includes/MediaWiki.php(287): MediaWiki->performAction()
#20 /var/www/techotopia/includes/MediaWiki.php(714): MediaWiki->performRequest()
#21 /var/www/techotopia/includes/MediaWiki.php(508): MediaWiki->main()
#22 /var/www/techotopia/index.php(41): MediaWiki->run()
#23 {main}