for ... in

Syntax for identifier in expression

statements

Action Evaluates expression as a list [or the address of a table]. For each item in the list [or in the table], for does the following:

1. assigns the value [the address] of the current item in the list to identifier;

2. executes statements;

Examples for i in {1, 3, 5, 7} {
msg (i);

clock.waitSixtieths (30)}

It posts the numbers 1, 3, 5 and 7 to the Main Window in sequence, pausing a half-second between each one.

folders = {"Extensions", "Control Panels", "Startup Items"}
for f in folders {
searchFolder (file.getSpecialFolderPath ("", f, false))}

This calls the script "searchFolder" for each of three special system folders.

for adr in @websites
msg (i);

clock.waitSixtieths (30)}

It posts the address of the items in your websites table to the Main Window in sequence, pausing a half-second between each one.

Notes Values [addresses] are assigned to identifier in the same order that they appear in the specified list [table].

The action of the for ... in statement for lists can be emulated using a standard for loop and the list and sizeOf verbs, as follows:

temp = list (expression)

for i = 1 to sizeOf (temp)

identifier = temp [i]

statements

The action of the for ... in statement for tables can be emulated using a standard for loop and the sizeOf verb, as follows:

adrtable = address (expression)

for i = 1 to sizeOf (adrtable^)

identifier = @adrtable^ [i]

statements

The ability to iterate thru tables was added in Frontier 6.1.

See Also for

sizeOf

list

break

continue

Discuss