[Solved] How to initialise many variables (in a loop)

Hi,

I have many buttons in my screen. I would like to be able to save their colors in “stored variables”.

Instead of having to manually create 1 variable block for each button, is there a way to do something like:

for button_i in all buttons of myApp:
initialize (stored) variable, name=button_i_color

1 Like

You should be able to do this with the blocks under the Any Component tab.

Something like this should fit the bill:

3 Likes

Oh thanks this is exactly what I needed!

It allowed me to make my code much more compact and scalable, now I could have a large amount of buttons and keep the same code :slight_smile:

BEFORE:

AFTER:

1 Like