Changing one list changes another one

I am creating a program where there are 2 lists, and you could add "Hello" to one of the lists through a button. I also have a button to set the first list to the second one, and a button to reset.

However, when I click the button to set the first list to the second one, every time I added "Hello" to a list, the other list gets another "Hello" too. How do I make it so that only one list gets a "Hello"?

listset.aia (2.6 KB)

Use the copy list block when you set the first list to the second list, otherwise the second list will always inherit the contents of the first list.

1 Like

this behavior is called call by reference, see also

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.