mirror of
https://github.com/tmrts/go-patterns.git
synced 2024-11-25 14:36:06 +03:00
6 lines
372 B
Markdown
6 lines
372 B
Markdown
# Generator Pattern
|
|
|
|
[Generator](https://en.wikipedia.org/wiki/Generator_(computer_programming)) 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](generators.go). |