I realize this may be against ruby principle and may seem a bit silly, but I am curious to whether it possible to modify the index variable during iteration of a loop in ruby.
This practice is possible in Java/C with the for loop in this contrived example:
for (int k = 0; k < 10; k++)
{
if (k == 5)
k = 8;
}
As well, I am aware that it is possible to access an index variable with Enumerable#each_with_index, but I am interested with the ability to alter the variable in this instance rather than access it.