Say i have an array of values:
string[] text = new string[] {"val1", "val2", "val3", "val4", "val5"};
Then i have a basic loop:
for(int i=0;i<=30;i++) {
Console.WriteLine(i + " = " + text[i])
}
Obviously this will cause an out of bounds exception, so what i want to do is when the counter reaches the upper bound of the array then go back to the start.
So
0 = val1
1 = val2
2 = val3
3 = val4
4 = val5
5 = val1
6 = val2
7 = val3
etc..