Welcome To Golang By Example

Menu
  • Home
  • Blog
  • Contact Us
  • Support this website
Menu

Author: admin

Close operation on a channel in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Close is an inbuilt function that can be used to close a channel. Closing of a channel means that no more data can we send to the channel.  Channel is generally closed…

Send and receive on a nil channel in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview The zero value of the channel is nil. Hence only declaring a channel creates a nil channel as default zero value of the channel is nil. Below is the result of send and…

Channel in Go (Golang)

Posted on August 14, 2020December 18, 2023 by admin

This is the  chapter 24 of the golang comprehensive tutorial series. Refer to this link for other chapters of the series – Golang Comprehensive Tutorial Series Next Tutorial – Select StatementPrevious Tutorial – Goroutines Now let’s…

Select statement with timeout in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview Timeout in select can be achieved by using After() function of time package. Below  is the signature of After() function. The After function waits for d duration  to finish and then it…

Empty select or select with no case in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview Select block without any case statement is empty select. The empty select will block forever as there is no case statement  to execute. We know that select statement gets blocked until…

Execute multiple case in Select statement in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview The select statement only executes one of the cases on which either send or receive channel operation is ready.  It cannot execute multiple cases but there is a workaround to it….

Break statement in Select in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview Break keyword can be used in select to terminate the execution of innermost statement similar to switch and for look. Below is the break keyword example in select. Code Output break statement will terminate…

Fallthrough keyword in select statement in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview Select doesn’t allow fallthrough keyword to select multiple cases. Fallthrough keyword can only be used in  switch statement to select multiple cases Only one case out of ready cases will be…

Select versus switch in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview Below are some of the differences between switch and select statement In switch each of the case statement is an expression while in select each of the case statement is either…

Select statement with a nil channel in Go (Golang)

Posted on August 14, 2020August 14, 2020 by admin

Overview Send or receive operation on nil channel blocks forever. Hence a use case of having a nil channel in the select statement is to disable that case statement after the the…

Posts pagination

Previous 1 … 33 34 35 … 62 Next
Follow @golangbyexample

Popular Articles

Golang Comprehensive Tutorial Series

All Design Patterns in Go (Golang)

Slice in golang

Variables in Go (Golang) – Complete Guide

OOP: Inheritance in GOLANG complete guide

Using Context Package in GO (Golang) – Complete Guide

All data types in Golang with examples

Understanding time and date in Go (Golang) – Complete Guide

©2025 Welcome To Golang By Example | Design: Newspaperly WordPress Theme