Repeat

See Also: Boolean Expressions, Execution Control Commands, For, Loop, Until, While, Break, Boolean

Purpose

Executes a repeating block of code.

Syntax

Repeat

Until {Boolean-expression}

What It Does

Until sends execution back to the last previous Repeat command until the {Boolean-expression} becomes true. When {Boolean-expression} becomes true, execution proceeds to the command next following the Until command.

A Repeat ... Until block will still execute once even if {Boolean-expression} is True, unless you program the Repeat command with conditionals to make it, also, subject to {Boolean-expression}.

Example

This sample shows how to loop through table rows using the global record buffer. It assumes that Index 1 of the Customer table is Customer_Number and unique (the only segment in this index).

Clear Customer

Repeat

    Find GT Customer By 1  // Index 1 = Customer_Number

    If (Found) Begin

        // do something with the customer record

    End

Until (not(Found))

 

Send ShowDetails

The function method InventoryCheck executes repeatedly until the Boolean variable bFinished is true. Execution then continues on to the next command.

Boolean bFinished

 

Repeat

    Get InventoryCheck To bFinished

Until bFinished

In this example, 1 is added to the variable iPlayers repeatedly, until it is greater or equal to 10. Keep in mind that iPlayers starts out at 0, since it is not specifically initialized to a value.

Integer iPlayers

 

Repeat

    increment iPlayers

Until (iPlayers >= 10)

 

Notes