ch1:=make(chanint)ch2:=make(chanint)gofunc(){time.Sleep(1*time.Second)ch1<-1}()gofunc(){time.Sleep(2*time.Second)ch2<-2}()fori:=0;i<2;i++{select{casemsg:=<-ch1:fmt.Println("Received from ch1:",msg)casemsg:=<-ch2:fmt.Println("Received from ch2:",msg)default:fmt.Println("No data available")}}
ch1:=make(chanint)ch2:=make(chanint)gofunc(){time.Sleep(1*time.Second)ch1<-1}()gofunc(){time.Sleep(2*time.Second)ch2<-2}()fori:=0;i<2;i++{select{casemsg:=<-ch1:fmt.Println("Received from ch1:",msg)casemsg:=<-ch2:fmt.Println("Received from ch2:",msg)default:fmt.Println("No data available")}}