fix #196
This commit is contained in:
@@ -68,11 +68,11 @@ channel通过操作符`<-`来接收和发送数据
|
||||
import "fmt"
|
||||
|
||||
func sum(a []int, c chan int) {
|
||||
sum := 0
|
||||
total := 0
|
||||
for _, v := range a {
|
||||
sum += v
|
||||
total += v
|
||||
}
|
||||
c <- sum // send sum to c
|
||||
c <- total // send total to c
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user