back

back(value: Any output): Boolean;

The back method of the JadeReversibleIteratorIF interface defines the behavior that it positions the iterator to the prior element in the iterable sequence; that is, in the opposite direction to the JadeIteratorIF interface next method implementation. If a prior element is available, it should be assigned to the output value parameter and the method returns true. If no prior element is available, the method returns false.

The first time this method is called, if the JadeIteratorIF interface next method has not already been called, it retrieves the last element in the iterable sequence.

The following example shows the use of the back method.

writeCustomerNames(customers: JadeIterableIF);
vars
   iterator: JadeIteratorIF;
   customer: Customer;
begin
   iterator := customers.createIterator();
   while iterator.back(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 back method implementation assigns something other than a Customer instance to the output value parameter, the behavior when next method is called is undefined.

2020.0.01 and higher