Skip to content

Latest commit

 

History

History
6 lines (4 loc) · 372 Bytes

generator.md

File metadata and controls

6 lines (4 loc) · 372 Bytes

Generator Pattern

Generator is a special routine that can be used to control the iteration behavior of a loop.

Implementation and Example

With Go language, we can implement generator in two ways: channel and closure. Fibonacci number generation example can be found in generators.go.