Skip to content

Instantly share code, notes, and snippets.

@yakuter yakuter/main.go
Created Apr 18, 2019

Embed
What would you like to do?
Kanallarda Select / Case Kullanımı
package main
import (
"fmt"
"time"
)
func main() {
kanalim := make(chan string)
go func() {
kanalim <- "mesaj"
}()
select {
case msg := <-kanalim:
fmt.Println(msg)
default:
fmt.Println("mesaj yok")
}
<-time.After(time.Second * 1)
select {
case msg := <-kanalim:
fmt.Println(msg)
default:
fmt.Println("mesaj yok")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.