mirror of
https://github.com/crazybber/awesome-patterns.git
synced 2025-02-16 21:53:13 +03:00
372 B
372 B
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.