Sitemap
Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.

Golang quick reference: Hello World

2 min readOct 31, 2023

--

package main

import "fmt"

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

package main:

Every Go program starts with a package declaration. The main package is the entry point for the Go compiler.

import "fmt":

This imports the "fmt" package, which provides functions for formatted I/O operations.

func main() {:

The main function is where our program starts executing. Every Go program must have a main function in the main package.

fmt.Println("Hello World!"):

This calls the Println function from the "fmt" package to print "Hello World!" to the console.

Run your program by typing go run <filename>.go. Happy coding!

Get Rahul Sid Patil’s stories in your inbox

Join Medium for free to get updates from this writer.

Try out this code on Go playground: https://go.dev/play/p/SDx5_QNEaoO

What is Go playground

Go playground is an excellent interactive tool to try out and learn Go programming. The good thing is it runs inside your web browser !!

Happy coding!!

Note: This article is part of my Golang: Quick Reference series for budding gophers.

Connect with me

Press enter or click to view image in full size

Thank you for being a part of the community

Before you go:

--

--

Author of 'Let Us Go' • AI-Native Engineering Researcher • Technologist • Entrepreneur

Stackademic
Stackademic

Published in Stackademic

Stackademic is a learning hub for programmers, devs, coders, and engineers. Our goal is to democratize free coding education for the world.