• Blog

    Remainder Operator

    Basic Operators in Swift Addition (+) Subtraction (-) Multiplication (*) Division (/)  Remainder Operator (%)     (similar to the Mod or Modulo operator in some other languages) The Remainder Operator Here is a brief explanation of the remainder operator (%) as it works in the Swift language, quoted from Swift’s website: The remainder operator (a % b) works out how many multiples of b will fit inside a and returns the value that is left over (known as the remainder). Note: The remainder operator (%) is also known as a modulo operator in other languages. However, its behavior in Swift for…