Introduction to Iterators
by Holger Klawitter

Table of Contents

Iterators for beginners
while and repeat-until -loops
Exercise 1
Some other nifty predefined iterators

Writing iterators
How an iterator works
A first iterator with a single quit
A single yield
Exercise 2
Exercise 3
Control flow in an iterator
More than one iterator per loop
Iterators more than once in a loop
Exercise 4

Iterators for experts
What are once arguments?
Exercise 5
'self' is always 'once'
Variable declaration in iterators
Recursive iterators
Exercise 6
Iterators in complex expressions
Exercise 7

Solutions for some of the exercises

Last modified: 07/09/96
Dipl. math. Holger Klawitter (