What you're finding out is that lists are passed by reference, so when you 
do tempList=initialList all you are really doing is making an additional 
pointer to the same list.

This can be very helpful, or very problematic, depending on what you're 
trying to accomplish! :)

But you want to actually save off a copy, so what you need to do is this:


   tempList = duplicate(initialList)


- Tab


At 07:24 PM 2/20/02 -0500, Changhsu P. Liu wrote:
>I'd like to delete some items during a calculation on a list. But, I want 
>it intact after all the calculation.
>So, I thought I save it to a temporary list and put it back when done.
>
>tempList = initialList
>...
>all the deleteAt on initialList
>...
>initialList = tempList -- to get it back so I thought
>
>But, to my surprise when I delete items from initialList, tempList get the 
>items deleted too. I can put the initial list content to a field and 
>extract them later after calculation. Is there a better way to deal with this?
>
>Thanks for the help,
>
>
>Changhsu Liu

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to