Code:
array1  var  byte[4]
...


for i = 0 to 3
array[i]=i
next i
Your code i believe will screw up the for...next loop because you will be changing the value of i.