Overview Select allows both send and receive operations from a channel in its case statement. Let’s see examples of One send one receive operation All send operations All receive operations One send…
Author: admin
Select with default case in Go (Golang)
Overview Similar to switch select can also have a default case. This default case will be executed if no send it or receive operation is ready on any of the case statement….
Select statement with a for loop outside in Go (Golang)
Overview There are two cases of for loop being outside a select statement Finite for loop outside select statement Infinite for loop outside select statement Let’s look at each one by one…
Select Statement in Go (Golang)
This is the chapter 25 of the golang comprehensive tutorial series. Refer to this link for other chapters of the series – Golang Comprehensive Tutorial Series Next Tutorial – ErrorPrevious Tutorial – Channel Now let’s check…
Goroutines in Go (Golang)
This is the chapter 23 of the golang comprehensive tutorial series. Refer to this link for other chapters of the series – Golang Comprehensive Tutorial Series Next Tutorial – ChannelPrevious Tutorial – Iota Now let’s check…
Receive or fetch multiple return values from a goroutine in Go(Golang)
Channels can be used to fetch return value from a goroutine. Channels provide synchronization and communication between goroutines. You can send the return value to a channel in the goroutine and then…
Receive or Fetch Return Value from a goroutine in Go(Golang)
Channels can be used to fetch return value from a goroutine. Channels provide synchronization and communication between goroutines. You can send the return value in a channel in the goroutine and then…
Access Underlying Variable of Interface in Go (Golang)
Overview Like any other variable, an interface variable is represented by a type and value. Interface value, in turn under the hood, consists of two tuple Underlying Type Underlying Value See below…
Zero Value of Interface in Go (Golang)
Default or zero value of an interface is nil. Below program demonstrates that Output
Non-struct Custom Type Implementing an interface in Go (Golang)
Overview It is also perfectly ok for any non-struct custom type to implement an interface. Let’s see an example Assume we have an interface animal as below Code Output The above program…