GitBucket
4.23.0
Toggle navigation
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
sample-golang
/
01_hello
Browse code
add channel sample
master
1 parent
5cfe514
commit
c76eb88919cea528c0231c785a634e8ff5bc1fc4
yhornisse
authored
on 9 Oct 2021
Patch
Showing
1 changed file
goroutine/channel.go
Ignore Space
Show notes
View
goroutine/channel.go
0 → 100644
package main import ( "fmt" "time" ) func hoge(done chan int64) { // chan int64 type for i := 0; i < 5; i++ { fmt.Println(i) time.Sleep(1 * time.Second) } done <- 10 // send } func main() { done := make(chan int64) go hoge(done) x := <- done // receicve fmt.Println(x) // 10 }
Show line notes below