You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
func main() {
|
|
var c chan int // 信道 c 的值为 nil
|
|
if c == nil {
|
|
fmt.Println("channel a is nil, going to define it")
|
|
c = make(chan int)
|
|
fmt.Printf("Type of c is %T", c) // 打印通道类型
|
|
}
|
|
|
|
fmt.Printf("\n")
|
|
a := make(chan int)
|
|
fmt.Printf("%T", a) // chan int
|
|
}
|