Writing generator functions with the yield statement