Version Ref: 6.1 (USP 6.1.01)
FOR f[(len,edit)] FROM exp TO exp [STEP exp] DO label
-
A loop that runs from a value to a value. Built in edits are supported.
If a STEP value is not supplied, filePro will determine a STEP value
based on the FROM and TO expression values. A FROM value that is less
than a TO value will result in a positive STEP ("1"). If FROM is greater
than TO the STEP value will be negative ("-1").
Each iteration of the loop will update the value of "f", incrementing by
STEP, and goto the label specified by DO.
Note: The FROM, TO, and STEP expressions are evaluated once when the loop is first executed. Changing these values once the loop starts executing will not change how the loop run.
Processing:
Then: FOR f(10,.0) FROM "1" TO "10" STEP "1" DO lp1; goto en1
lp1 If:
Then: msgbox f ' print the value of "f" from 1 to 10
Then: end
en1 If:
Then: FOR d(10,mdyy/) FROM "12/01/2024" TO "12/31/2024" DO lp2; goto en2
lp2 If:
Then: msgbox d ' print the value of "d" from 12/01/2024 to 12/31/2024
Then: end
en2 If:
Then: end
Version Ref: 6.1 (USP 6.1.01)
WHILE cnd DO label
-
A loop that runs while the condition is true. Each iteration checks the
condition (cnd) and while the value is true goes to the label specified by
DO. A condition can be an IF expression or label.
Processing:
Then: declare total(10,.0)
Then: total="0"
Then: lookup inv=invoice r=(rec) -nx
Then: WHILE inv DO lp1; goto en1
lp1 If:
Then: total=total+inv(1)
Then: getnext inv
Then: end
en1 If:
Then: close inv; end
Version Ref: 6.1 (USP 6.1.01)
LOOP label WHILE cndLOOP label UNTIL cnd
-
A loop that runs while the condition is true (WHILE) or until the condition
is true (UNTIL). Each iteration starts by going to the label specified by
DO, then the condition is checked and the loop either continues or
terminates based on the value of the condition. A condition can be an IF
expression or label.
Processing:
Then: i(10,.0)="10"
Then: LOOP lp1 WHILE i gt "0"; goto en1
lp1 If:
Then: i=i-"1";
Then: end
en1 If:
Then: end