Valeur enveloppante de l'unité

// Wraping around an array or list
currentIndex = (currentIndex + 1) % myList.Count; // Forward
currentIndex = (myList.Count + currentIndex - 1) % myList.Count; //Backward
Programming Doggo