LOOP...ENDLOOP

Command

The LOOP...ENDLOOP command block specifies the number of times to iterate calculations. All commands between the LOOP and ENDLOOP statements are performed the number of times that you specify.

Syntax

LOOP (integer, [break])
COMMANDS ;
ENDLOOP

integer The integer constant that indicates the number of times to execute the commands contained in the loop block.
break Optional parameter used to break the iterative process of a loop. break must be the name of a temporary variable (VAR). Setting the value of the variable to 1 during the execution of the loop causes the loop to break at the beginning of its next iteration.
COMMANDS Those commands that you want to be executed for the duration of the LOOP.

Description

LOOP is a block command that defines a block of commands for repeated execution. As with the FIX command, you can nest LOOP statements if necessary.

The ENDLOOP command ends a LOOP command block. It terminates the LOOP block and occurs after the commands in the LOOP block, but before any other commands.

Example

In this example, the LOOP command finds a solution for Profit and Commission. This operation is done as a loop because Profit and Commission are interdependent: Profit is needed to evaluate Commission, and Commission is needed to calculate Profit. This example thus provides a model for solving simultaneous formulas.

FIX("New York",Camera,Actual,Mar)
   LOOP(30)
      Commission = Profit * .15;
      Profit = Margin - "Total Expenses" - Commission;
   ENDLOOP;
ENDFIX

See Also

FIX...ENDFIX


Copyright (c)1991-2000 Hyperion Solutions Corporation. All rights reserved.