Swift Operators
Arithmetic: + - * / %. Comparison: == != < > <= >=. Logical: && || !. Range operators are ... (closed) and ..< (half open). The nil coalescing operator is ??.
Example
let a = 17, b = 5
print(a + b, a - b, a * b, a / b, a % b)
print(a > b && b > 0)
print(17.0 / 5)Exercise
Remainder operator.
17 5
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.