Passing a variable into a function

I am sure somebody has solved this:
Assigning list of variables to series of fields

I have a list of values, and I want to assign each value in turn to a series of labels:

variable MyList = a,b,c,d
set Label1’s text to (get from MyList #1)
set Label2’s text to (get from MyList #2)
set Label3’s text to (get from MyList #3)
set Label4’s text to (get from MyList #4)

If I was hand coding I would have a loop, something like
variable MyList = a,b,c,d
j=1
Do while j < 5
set <Label & j>'s text to (get from MyList #j )
next j

Is this possible in the blocks?

I did try to insert a picture of the problem, not sure it worked
Christopher Hunt

1 Like

Are you looking for something like this?

2 Likes

That does exactly what I want:
Assigning list of variables to series of fields solution

Much cleaner
Had to search for the “Any component” drawer

Thanks

2 Likes

Sometimes, this drawer becomes a code saver.

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