Switch in GoLang

Switch Statement is another way of controlling the flow in GoLang. It is pretty much similar to if statements but both have their advantages and disadvantages depending on your use case. Below is a simple switch structure: switch { case condition-1:

If, Else-If, Else Conditions in GoLang

We can control the flow of the program depending on the values of variables or the boolean result of functions. Below is a simple if structure: if condition-1 { // Code Block 1 - Executed if condition-1 is true } else if condition-2

Loops in GoLang

Similar to other programming languages, GoLang has its own way of looping or repeating a block of codes. However, there is only one loop in GoLang, which is for loop. In GoLang, for loop has different forms for different use

GoLang Variable Declaration

In GoLang, there are multiple ways to declare a variable. Let's look at an example below: package main import "fmt" func main() { // Default Initialization var s int fmt.Println("Value of s is: ", s) // Shorthand Declaration x := 3 fmt.Println(

Go Commands

go runThe command for executing a go program. Example: To run the main.go file, execute the command below: go run main.gogo buildTo build the code to an executable and distributable program. Example: To build the project with main.

Hello, World

Just like any other programming tutorial, we'll start with the Hello World application. The code below may be the simplest code that could ever be written in GoLang. We will be dissecting each line of the code below as we