Created
February 22, 2019 17:10
-
-
Save alvpickmans/f7cde898970c7c859d41a55a93ca8303 to your computer and use it in GitHub Desktop.
Getting the next index of index in an array, looping to 0 if is last index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i = 0; i < MyArray.Count(); i++) | |
{ | |
int nextIndex = (i + 1) % MyArray.Count(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment