an example that shows only the most essential parts of flow control with generators