Mastering a programming language takes years of time but learning a new language does not. And Trust me, Nobody is perfect when it comes to coding. As a software engineer, one should be at least familiar with minimum 4–5 different languages or at least he should know how to learn a new language in small amount of time. Well, just to let you guys know, i recently switched from python and javascript to Golang. So, This post is just an attempt to guide developers on how to smoothly switch from one language to another. Note : [ This post is for people who have prior experience of any programming language and wants to learn practical Go programming concepts in a quick and easy way (just by looking at Go code !) ] Step 1 : Why does the language exist and what are its advantages Golang is a very powerful and popular programming language in the software industry. Golang is expressive , statically typed, compiled language, is fast and reliable and a lot better than JavaScript and Python in many ways. It is slowly gaining momentum and is becoming the first language of choice among many developers for developing software’s, modern web apps and app backend. It is used to make a large scale and reliable apps that involves concurrency. The only con of using go is that their are very few number of resources on the internet to learn or to do/complete tasks and develop software. Step 2 : Setup, Installation & running the “Hello world” Program . In order to learn a new language one needs to download the language (binaries /SDK) itself. So, simply download golang by clicking on the link below. Link : . Set up a workspace and create a basic go file in the text editor, copy and paste the below code and run the file . https://golang.org/dl/ Directly run the file by : go run <filename.go> Or compile it to make an executable file by : and then run it as an executable by go build <filename.go> ./<executable_file> main { fmt.Println( ) } package import "fmt" func main () "Hello World !" If the code outputs Hello World ! You are good to go :) Few Noteworthy points : Every file that we need to execute must have a main package at the top. Next comes the import statement for reading and writing. Next is the main function from where the program starts. Step 3 : Basics of Programming, Syntax and Coding Patterns. When it comes to programming, basics remains the same. No matter what language we are learning there will always be data types, if else statements, loops, switch statements etc …. Lets look at the basics of Golang. Here, i will be discussing about : Data Types Control Statements Functions (defining and declarations) Loops Pointers Error Handling Packages (creating and importing) creating data structures Lets look at them one by one. Data Types Like all other languages, Golang also supports a lot of similar primitive datatypes like int , float64, strings ,bool etc … let’s look at the syntax : < var > <variable_name> <data_type> = <value> syntax 1 : <variable_name> := <value> syntax 2 : x fmt.Println(x) x := fmt.Println(x) name := fmt.Println(name) array [] { , , , , , } fmt.Println(array) fmt.Println(array[ ]) (array, ) fmt.Println(array) var int // output 0 or 5 // output 5 "Karan" // output karan var int 1 2 3 4 5 6 // output [1,2,3,4,5] 2 // output 3 append 7 // output [1,2,3,4,5,7] Control Statements, Functions, Importing packages Let’s look at the basics of control flow statements like ( if else, switch, loops ) , function declarations and function calling in Golang with the help of an example. of a function can be seen below. Syntax func <function_name>(param_name param_type) < return_type>{ code } : go install <package> or go get <package> Syntax for fetching package main ( ) { add_of_number := sum( , ) square_of_number := square( ) factorial_of_number := factorial( ) fmt.Println(add_of_number,square_of_number,factorial_of_number) print_n_numbers( ) } { x + y } { x*x } { x < { } x*factorial(x ) } { i:= ; i<x+ ; i++ { fmt.Println(i) } } // 1st line is always the package package // Importing basic packages in golang import "fmt" func main () 5 10 5 5 3 func sum (x , y ) int int int return func square (x ) int int return func factorial (x ) int int if 1 return 1 return -1 func print_n_numbers (x ) int for 1 1 // output // 15 25 120 1 2 3 Error Handling, Pointers and Struct types Go doesn’t have Exceptions so we have to check errors manually and also a function can return multiple values. Golang struct are used to combine multiple types of data into one. It can also be used to create a new data structure. Lets look at an example. Interesting fact : main ( ) person { name age height } { number := fmt.Println(&number) fmt.Println(number) increment_number(&number) fmt.Println(number) sqrt_result , err := sqrt( ) err != { fmt.Println(err) } { fmt.Println(sqrt_result) } p := person{name: ,age: ,height: } fmt.Println(p) fmt.Println(p.name) } { x< { , errors.New( ) } { math.Sqrt(x), } } { *x++ } // 1st line is always the package package // Importing basic packages in golang import "fmt" "errors" "math" // struct type type struct string int float64 func main () // Pointers .. 10 // Error Handling .. 16 if nil else // accessing struct in golang .. "karan" 25 5.10 func sqrt (x ) float64 ( , error) float64 if 0 return 0 "Negative number is not allowed !" else return nil func increment_number (x * ) int // output // 0Xc82000a2f0 10 11 4 {karan 25 5.1} karan That’s it for this post. I hope you liked it. Till then, Keep coding and keep learning.