As you will learn in a short while, the select keyword is pretty powerful and can do many things in a variety of situations. The select statement in Go looks like a switch statement but for channels. In practice, this means that select allows a goroutine to wait on multiple communication operations. Therefore, the main benefit that you receive from select is that it gives you the power to work with multiple channels using a single select block. As a consequence, you can have nonblocking operations on channels, provided that you have appropriate select blocks.
The biggest problem when using multiple channels and the select keyword is deadlocks. This means that you should be extra careful during the design and the development process in order to avoid such deadlocks.
The Go code of select.go will clarify the use of the select keyword. This program will be presented...