> For the complete documentation index, see [llms.txt](https://hantmac.gitbook.io/mastering-go-second/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hantmac.gitbook.io/mastering-go-second/09.0/09.4/09.4.3.md).

# 09.4.3 通道作为函数参数传递

来看代码：

```go
package main
import (
"fmt"
)
func main() {
    willClose := make(chan int, 10)
    willClose <- -1
    willClose <- 0
    willClose <- 2

    <-willClose
    <-willClose
    <-willClose

    close(willClose)
    read := <-willClose
    fmt.Println(read)
}
```

代码创建了一个int类型的通道`willClose`，并且向其中写入三个值，然后再依次读出来。后面关闭这个通道后，再尝试从其中读数据，执行这个程序输出结果：

```bash
$ go run readClose.go
0
```

这个结果表明，如果我们尝试从关闭的通道中读取数据，其会返回基本类型的初始值。
