Index..Do

Revision as of 20:47, 7 March 2007 by Lchrisman (Talk | contribs)


The construct, Index i := seqExpr defines an index local to the definition in which it is used. The expression seqExpr may be a sequence, literal list, or other expression that generates an unindexed array, as used to define a global index. For example:

Variable PowersOf2
Definition: Index J := 0..5; 
            2^J

The new Variable PowersOf2 is an array of powers of two, indexed by the local index J, with values from 0 to 5:

PowersOf2 → PowersOf2.jpg

The dot operator let's you refer to a local index of an array.

Syntactic Variations

Index I := seqExpr Do bodyExpr

or

Index I := seqExpr;
expr;
expr;
...

To control the index name, separate from the local variable name:

Index I / nameExpr := seqExpr Do bodyExpr

See Also

Comments


You are not allowed to post comments.