Inspiration

I got introduced to the term "Go" in one of my bootcamp and I wanted to explore it since then! Go was developed by Google, so what else do you need to get inspired!

I was following this tutorial from freeCodeCamp

Key features

1) Garbage collector 2) Fast compile time 3) Built in concurrency 4) Statically typed 5) Compile to standalone binaries

Variables

There are 3 ways to assign values to variables in Go.

var i int i = 42 or var i int = 20 or i := 42 := type inference

Go can understand what is the type of the variable once you assign a value to it. Hence it isn't necessary to statically mention the type.

Shadowing

var i int = 32

func main() {
    fmt.println(i)
    var i int = 43 
    fmt.Println(i)
}

First time 32 will be printed as it is referring to the i outside all functions(at global level), in the second time 43 will get printed as it is referring to the i inside the main function(local vairable) this is known as shadowing.

Hello World Program

package main

import "fmt"

func main() {
  fmt.Println("Hello World")
}

Built With

Share this project:

Updates