Go-day01

Go-实现hello_world

package main

import "fmt"

func main() {
	fmt.Println("hello world!")
}

  

1.管道 channel
  类似unix/linux的pipe
  多个goroute之间通过channel通信
  支持任何类型
  func main(){
  pipe := make(chan int,3) //chan 管道 3代表管道的大小
  pipe <- 1
  pipe <- 2

  }

  csp模型(Communication Sequential project) goroute+channel

  全局变量也可以做,但是不建议使用

猜你喜欢

转载自www.cnblogs.com/liujiliang/p/8981330.html
今日推荐