mirror of
https://github.com/tmrts/go-patterns.git
synced 2026-11-11 23:07:51 +03:00
concurrency/generator: refactor generator pattern
This commit is contained in:
1 parent
d05638adac
commit
89df9f0955
2 files changed
+27
-2
No files matched your search
@@ -1,6 +1,7 @@
|
||||
# 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.
|
||||
[Generators](https://en.wikipedia.org/wiki/Generator_(computer_programming)) yields a sequence of values one at a time
|
||||
|
||||
# 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).
|
||||
|
||||
You can find the implementation and usage in [generator.go](generator.go)
|
||||
Reference in new issue
Block a user