select ਇੱਕ goroutine ਨੂੰ ਮਲਟੀਪਲ channel ਓਪਰੇਸ਼ੰਸ ਉੱਤੇ ਇੱਕੋ ਵਾਰ wait ਕਰਨ ਦੇਣ ਦਿੰਦਾ ਹੈ, ਜੋ ਵੀ ਪਹਿਲਾ ready ਹੋ ਉਹ ਅੱਗੇ ਵੱਧਦਾ ਹੈ। ਇਹ channels ਲਈ switch ਵਾਂਗ ਹੈ — concurrent ਓਪਰੇਸ਼ੰਸ, timeouts, ਅਤੇ cancellation ਨੂੰ coordinate ਕਰਨ ਲਈ ਜ਼ਰੂਰੀ ਹੈ।
ਬੇਸਿਕ select — ਮਲਟੀਪਲ channels ਉੱਤੇ wait ਕਰੋ
{
msg1 := <-ch1:
fmt.Println(, msg1)
msg2 := <-ch2:
fmt.Println(, msg2)
ch3 <- :
fmt.Println()
}
