Tinderbox v9 Icon

Loop variable arguments

Loop variables

A small number of operators (see a listing) employ a user-named 'loop variable'.

Loop variables, or 'loopVar', are a special form of input. Though not strictly an argument, a loop variable is most easily understood in the usage for list.each(loopVar){} operator.

The important point to understand, and which confuses new users, is that the 'name' if the loop variable is whatever the user chooses. So, if coding an .each() loop like this:


the variable's name is 'anItem' or if coded:


it is 'x', or:


is it 'foobar', etc.

A key point is using the loop variable's name anywhere inside the loop (i.e. within the { } curly braces) the current value of the loop variable is the value of the source list item currently being processed. In the first example above, on the first iteration of the loop 'anItem' has the value of the first item in $MyList, in the second loop the second $MyList item, etc.