1 vote

How to Wrap Around Array Indexes?

If you want to wrap negatively aswell (arrayIndex + arrayLength) % arrayLength + arrayLength first turns a negative index positive.
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible