1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2025-02-23 07:33:20 +03:00
go-patterns/concurrency/generator.md

6 lines
353 B
Markdown
Raw Normal View History

2016-09-06 15:45:18 +08:00
# Generator Pattern
2016-09-07 00:20:30 +08:00
[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.
2016-09-06 15:45:18 +08:00
# Implementation and Example
2016-09-07 00:20:30 +08:00
With Go language, we can implement generator in two ways: channel and closure. Fibnacci example can be found in [generators.go](generators.go).