If your chosen language supports modular arithmetic for user-defined types then incrimenting or decrimenting a modular integer will result in a value within the range of that modular integer.
Ada allows the user to specify modular types. The Ada solution for your question is
type Index_type is mod 6;
type Example is array(Index_Type) of Integer;
Iteration through the array, treating it as a circular buffer, can be done with a simple loop
declare
I : Index_Type := 0;
A : Example;
begin
loop
A(I) := some_value;
I := I - 1;
end loop;
end;
Within the loop I can be incremented or decremented, and the arithmetic will always be modulo 6 in this case. In Ada such circular buffers are sometimes used in producer/consumer patterns. In that case there are separate read and write indices, with a check for a buffer full condition upon each write and a check for a buffer empty condition upon each read.