Created
October 22, 2013 11:07
-
-
Save brunomikoski/7098760 to your computer and use it in GitHub Desktop.
A simple way to circular navigation in arrays.
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
//Next | |
int i = (i+1) % targetArray.Count | |
//Prev | |
int i = (i + (targetArray.Count-1)) % targetArray.Count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment