i'm using array of class; class simple , contains 1 element. class declared follows:
class cell public info int16 end class the array:
dim maze(11, 15) cell i want use simple sub set .info variable every element 15, realise have create elements first. tried using each loop follows, didn't work, when loop completed still set nothing:
for each e cell in maze if e nothing e = new cell end if next i'm not concerned correct solution: used regular loop , accomplishes want done...
for = 0 maze.getupperbound(0) b = 0 maze.getupperbound(1) maze(a, b) = new cell maze(a, b).info = maze(a, b).info or 15 next next ...but i'd know why each loop didn't work in first place, i'm sure there's fundamental principle i'm missing here.
the reason for each loop did not work because within for each construct, local variable (in case e) not reference, rather copy; new cell has no consequence on array of cell.
Comments
Post a Comment