Determines if a
For...Next loop should be terminated
Syntax
Usage
For iterator [ As typename ] = start_value To end_value [ Step step_value ]
[ ...statements... ]
Next
Parameters
typename
cond,
end_value
a typename object used as a loop-terminating value
stp,
step_value
a typename object used as an incremental value
iterator
a typename object used as an iterator
start_value
a typename object used to copy construct or assign to the iterator initially
Description
Operator For,
Operator Next and
Operator Step can be overloaded in user-defined type definitions to allow objects of that type to be used as iterators and step values in
For...Next loops.
Operator Next is called every time the iterator needs to be checked against the end value. This happens immediately after the call to its
Operator For, and immediately after any calls to its
Operator Step.
Operator Next should return zero (0) if the loop should be terminated, or non-zero if the loop should continue iterating. The first time
Operator Next is called, no statements in the
For...Next body, if any, have been executed yet.
The first version of
Operator Next is used if no step value is given in the
For...Next statement. If a step value is given, the second version is used and is passed the step value.
Example
Dialect Differences
See also