diff options
Diffstat (limited to 'doc/progs/sieve1.go')
| -rw-r--r-- | doc/progs/sieve1.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/progs/sieve1.go b/doc/progs/sieve1.go index 0ae3893ab..7dd5ecc2c 100644 --- a/doc/progs/sieve1.go +++ b/doc/progs/sieve1.go @@ -6,12 +6,12 @@ package main import "fmt" -// Send the sequence 2, 3, 4, ... to returned channel +// Send the sequence 2, 3, 4, ... to returned channel func generate() chan int { ch := make(chan int); - go func(){ + go func() { for i := 2; ; i++ { - ch <- i + ch <- i; } }(); return ch; @@ -22,8 +22,8 @@ func filter(in chan int, prime int) chan int { out := make(chan int); go func() { for { - if i := <-in; i % prime != 0 { - out <- i + if i := <-in; i%prime != 0 { + out <- i; } } }(); |
