CHAPTER 4

image

Operators

Operators Defined

Operators are used to perform operations on values. You can do arithmetic, assignment, logical, and relational operations with operators.

Arithmetic Operators

Arithmetic operators are used to perform math on values. You can use arithmetic operators to perform addition, subtraction, multiplication, division, and modulus (the remainder from a division operation). Table 4-1 lists Objective-C’s arithmetic operators.

Table 4-1. Arithmetic Operators

Operator

Meaning

+

Addition

-

Subtraction

*

Multiplication

/

Division

%

Modulus

An operation will look like a math problem.

1.0 + 2.0 – 3.0 * 4.0 ...

Get Objective-C Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.