next

next(value: Any output): Boolean;

The next method of the JadeIteratorIF interface defines the behavior that advances the iterator to the next element in the iterable sequence. If a next element is available, it should be assigned to the output value parameter and the method returns true. If no next element is available, the method returns false.

The first time this method is called, it should retrieve the first element in the iterable sequence.

The following example shows the use of the next method.

writeCustomerNames(customers: JadeIterableIF);
vars
    iterator: JadeIteratorIF;
    customer: Customer;
begin
    iterator := customers.createIterator();
    while iterator.next(customer) do
        write customer.getFullName();
    endwhile;
epilog
    delete iterator.Object;
end;

In this example, the next method has been implemented to return a Customer instance. If this next method implementation assigns something other than a Customer instance to the output value parameter, the behavior is undefined when the next method is called.

2020.0.01 and higher