The way of implementing iterators are known as generators. It is a normal function except that it yields expression in the function.