FOR(4)

Table of Contents

Name

for looping construct

Synopsis

%for(expr1; expr2; expr3) %loop
template-stuff
%end-loop

Description

The for template construct provides a looping mechanism that is modeled after the C for-loop. The three expressions are C expressions. The first expression is evaluated upon loop entry; this typically initializes a loop variable. The second expression is the termination condition; as long as it remains TRUE, iteration of the loop continues. During each iteration the contents of the template-stuff that makes up the body of the loop is generated to the product. The third expression is executed after each iteration; this typically modifies a loop variable.

Loop variables are not automatically declared. Normally their declarations are placed in the declare section of the product description file.

Example

The following product description
%declare
static int j;

%template
%for (j=0; j<10; ++j)
%loop %(itoa(j)), %end-loop
would generate the product:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,

See Also

DECLARE(3)
WHILE(4)
FORALL(4)


© 1990 Lucent Technologies, Inc
© 1998 Harmony Software, Inc