package main

import "fmt"

func main() {

	intChan := make(chan int, 100)
	for i := 0; i < 100; i++ {
		intChan <- i*2
	}
	// 遍历时,如果channel没有关闭,则会出现deadlock错误
	close(intChan)
	// channel遍历
	for v := range intChan {
		fmt.Println("v =", v)
	}

}