Loops and Iterators Sather - Language Specification Prev Next Chapter 8. Loops and Iterators Table of Contents 8.1. Iterators are used extensively in Sather to control loops. This section elaborates their semantics and describes the built-in iterators that correspond to statements such as ' while ' and ' do ' found in other languages.
Iteration is done with loop statements , used in conjunction with iterator calls.
An execution state is maintained for each textual iterator call. When a loop is entered, the execution state of all enclosed iterator calls is initialized. When an iterator is first called in a loop, the expressions for self and for each once argument are evaluated left to right. On subsequent calls, only the expressions for arguments which are not once are re-evaluated. Method call semantics are detailed on See Method call expressions .