Golang_tutorial_zero_to_hero

Hello World

The first program that every programmer must make in every language is commonly known as hello world. We will set up a program and then tell it to print out a sentence “hello world!”.

To start navigate to the Go Play Space in your browser. This is an interactive website that allows the programmer to test out their go code before running it on their personal computers.

Once you have arrived at the site you should find that it has some text already written on the screen. This is a program ready for you to run. It should look something like this.

package main

import (
	"fmt"
)

func main() {
	fmt.Println("The bigger the interface, the weaker the abstraction.")
}

There are three parts to this code: the package declaration package main, the imported packages import ( "fmt" ), and the function func main(){ fmt.Println("Hello, playground")}. We will cover in much more detail how each of these three parts is important to your go code, but for now we just want you to run your very first go program. Click on the line with "Hello, playground" and change the text to say "Hello World!" (don’t forget the quotation marks). Now press the Run button found at the top of your screen.

Hello World!

Program exited.

Viola! You have just run your first Go program. Feel proud! Your are one step closer to becoming a full fledged Gopher!

Continue