How do you change a variable within a loop?

I need to change the value of a variable depending on the value of a text.
I could loop through a list of texts to get the value,s but don't know how to change the global variable each time I compare the Text value.
The attached image is the current block for one of the Text. in this example the value of Global A1 is determined by the value of Arrow1,text.. The arrows are Arrow1 to Arrow15 and the variables are Global A1 to Global 15.
Apart from repeating the attached blocks 15 times, I am really struggling, so any help would be appreciated


Morning AGB,
Thanks for your reply, not meaning to sound ungrateful, but one of my previous efforts was to make a list of the Global variables, (even though I wasn't sure what to do with it), but this was not allowed, so I assume you mean make a list of the Arrows, which I have already done. My issue is what to do with the list, I can loop through each element of the list, but don't know how to change the variable for each pass of the loop, does this make sense

Will it be X = 10, M = 0, for all arrows?

Hi, Yes it will

You may have to change things around a bit, you don't show what you are then doing with the variables. You need to build a single list of the values, and then assign them using the indexing of the list

From this vars at index 1 will = 10 if textbox1 = X, which is equivalent to the value of a variable A1

1 Like

Thanks for your help, I'm on my way out now, will try later and update with results

Alternatively, you could just use a single list of lists:

Thank you very much. this works.
In my case there s a big difference between knowing what you want and knowing how to get it. I knew i needed to match the Global var and list together but didn't know how.
A person can have many great ideas, and the tools can be right in front of him, but unless he knows how to use them, it can be very frustration.
Once again Thank you.
I didn't try the 2nd method, as still trying to understand the 1st

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.