Over Statements

The Over statement is a convenient way off processing all the elements of an array.

overstmt ::= Over arrayexpr As identifier Do stmtblock EndOver ;

The arrayexpr is any expression that yields an array as a result.

The identifier is an identifier that has not yet been declared within the current routine.

The stmtblock is a standard list of statements with an optional OnError section.

The system will go through all the elements of the array and will assign each element in turn to the datum created and accessed via the identifier. If the array is constant then the working datum will also be constant, otherwise setting the datum will affect the value in the actual array.

Unlike with the For loops, the control variable must not be declared in the routine local variable list. No identifier should be used for more than one Over loop within a routine. The identifiers should not be accessed outside the loop.

For a multi-dimensional array the rightmost index will be traversed first. You can use arrays of any data type.

Within the Over block it is possible to break out before all the elements have been processed using the OBreak statement.

obreakstmt ::= OBreak ;

The OBreak statement must only appear within an Over loop ( invariably within some nested conditional statement ).

[= double each number in the array =]
Over myarray As element Do
	element *= 2;