1 post found
Swift's % operator is a remainder, not a modulo: its result takes the sign of the left-hand side, so -1 % 7 is -1, not 6. Here's why wraparound indexes crash on the back button, why Double has no % at all, and the one-line helper that fixes it.