<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>select on Golang</title><link>https://golang.k5kc.com/tags/select/</link><description>Recent content in select on Golang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 16 Aug 2020 00:12:00 +0530</lastBuildDate><atom:link href="https://golang.k5kc.com/tags/select/index.xml" rel="self" type="application/rss+xml"/><item><title>Go - select</title><link>https://golang.k5kc.com/2020/08/16/3.select/</link><pubDate>Sun, 16 Aug 2020 00:12:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/3.select/</guid><description>Syntax
The select statement waits for multiple send or receive operations simultaneously.
// Blocks until there&amp;#39;s data available on ch1 or ch2 select { case &amp;lt;-ch1: fmt.Println(&amp;#34;Received from ch1&amp;#34;) case &amp;lt;-ch2: fmt.Println(&amp;#34;Received from ch2&amp;#34;) } The statement blocks as a whole until one of the operations becomes unblocked. If several cases can proceed, a single one of them will be chosen at random. Send and receive operations on a nil channel block forever.</description></item></channel></rss>