package main
import "fmt"
func main() {
// var chan 变量名 数据类型
// 声明channel
var intChan chan int
intChan = make(chan int, 3)
fmt.Printf("intChan = %v intChan地址 = %v\n", intChan, &intChan)
// 写入数据
intChan <- 2
num := 6
intChan <- num
intChan <- 8
fmt.Printf("len = %v, cap = %v\n", len(intChan), cap(intChan))
var num2 int
// 读取数据
num2 = <- intChan
fmt.Println("num2 = ", num2)
fmt.Printf("len = %v, cap = %v\n", len(intChan), cap(intChan))
}