Lotus Software logo
IBM Lotus Domino Designer 8.5
  Versions 8.5 and 8.5.1






Do statement

Executes a block of statements repeatedly while a given condition is true, or until it becomes true.

Syntax 1

Do [ While | Until condition ]

[ statements ]

Loop

Syntax 2

Do

[ statements ]

Loop [ While | Until condition ]

Elements

condition

Any numeric expression. 0 is interpreted as FALSE, and any other value is interpreted as TRUE.

Usage

In Syntax 1, condition is tested before entry into the loop, and before each subsequent repetition. The loop repeats as long as condition evaluates to TRUE (if you specify While), or until condition evaluates to TRUE (if you specify Until).

In Syntax 2, condition is tested after the body of the loop executes once, and after each subsequent repetition. The loop repeats as long as condition evaluates to TRUE (if you specify While), or until condition evaluates to TRUE (if you specify Until).

Terminating the loop

You can exit the loop with an Exit Do statement or a GoTo statement. Exit Do transfers control to the statement that follows the Do...Loop block; GoTo transfers control to the statement at the specified label.

If you do not specify a While or Until condition, the loop will run forever or until an Exit Do or a GoTo statement is executed within the loop. For example, this loop executes forever:

Do  

' ...
Loop

Language cross-reference

@DoWhile function in formula language

@While function in formula language

See examples

Examples: Do statement
Related topics
LotusScript Language Reference: A through D
Exit statement
For statement
ForAll statement
While statement




Library | Support | Terms of use |

Last updated: Monday, October 5, 2009