Sends an element of a collection to a loop of the type
- Mandatory value of a data type compatible with the return type of the procedure. The loop receives this value.
Yield returns one element of a collection.
You must use
Yield in a method or
Get accessor of a property with the modifier
An iterator is a procedure that does special iterations over a collection.
For Each consumes data from an iterator.
Each iteration of the loop calls the iterator procedure.
While in the procedure,
expression and stores the location where execution stopped.
Execution starts again from that location with a subsequent call to the iterator.
The data type of
expression must be compatible with the return type of the procedure.
You can use one of the statements
Exit Property, or
Return to stop the iterator.
An iterator procedure must obey the rules that follow.
- It must be one of
Property, then it must have an accessor (
- It must have the modifier
- It must not have a parameter with the modifier
See Iterators for more information.
Yield is permitted in the block
Try of the statement
But it is not permitted in blocks of the types