GLBasic forum

Main forum => GLBasic - en => Topic started by: MrPlow on 2013-Aug-25

Title: TYPES and Deletes
Post by: MrPlow on 2013-Aug-25
Hi,

Just a quick question... I have had bugfor while now with a type not working as I expected after a delete from a TYPE list.

How does a TYPE FOREACH affect looping ? If a delete a different unit and it is in the same loop but not the same current item will the FOREACH index move position if the deleted item is before it??

Hope i made this example clear enough...



Title: Re: TYPES and Deletes
Post by: kanonet on 2013-Aug-25
If you want to delete something from array in a FOREACH loop use DELETE. Never ever use DIMDEL, DIM or REDIM on same array in a FOREACH or things will go horribly wrong!
Title: Re: TYPES and Deletes
Post by: MrPlow on 2013-Aug-25
Thanks!

I have sorted out my problem...seems the array shifts when you delete items...so I leave my deleting until after the foreach is complete!

Just just flag items for delete...so good when it works as planned!

G