Generators

What is a generator? #

A generator function is a function that we can start and stop, for an indefinite amount of time. And also restart with the possibility of passing additional data at a later point in time.

To create a generator function we write like this:

Get hands-on with 1200+ tech skills courses.