mirror of
https://github.com/tmrts/go-patterns.git
synced 2025-02-16 12:33:16 +03:00
fix typo
This commit is contained in:
parent
4ec77fe119
commit
8e6c437754
@ -3,4 +3,4 @@
|
||||
[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. Fibnacci example can be found in [generators.go](generators.go).
|
||||
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).
|
@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
//FibonacciClosure implements fibonacci number generatoin using closure
|
||||
//FibonacciClosure implements fibonacci number generation using closure
|
||||
func FibonacciClosure() func() int {
|
||||
a, b := 0, 1
|
||||
return func() int {
|
||||
@ -13,7 +13,7 @@ func FibonacciClosure() func() int {
|
||||
}
|
||||
}
|
||||
|
||||
//FibonacciChan implements fibonacci number generatoin using channel
|
||||
//FibonacciChan implements fibonacci number generation using channel
|
||||
func FibonacciChan(n int) chan int {
|
||||
c := make(chan int)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user