DEV Community

Rahul Upakare
Rahul Upakare

Posted on

Learn Go with "Hello, world" programs

Hello, world

A "hello, world" program is a program which outputs or displays "hello, world" message. It often illustrates the basic syntax of programming language. Perhaps, this tradition was started from the book The C Programming Language, by Brian W. Kernighan and Dennis M. Ritchie, 1978.

Recently, mostly for fun learning, I've started writing "hello, world" program to try out Go language. I think it becomes easy to understand the code syntax and concepts, if you already know what output the code is going to have. 

In this post, I am showing you the initial list of "hello, world" programs, which I plan to keep updating with explanation and adding more over a period of time. I would be glad to hear your feedback and open to your contributions to make it a useful resource. Github Repository

Print (traditional)

Variables - string

Variables - int

Variables - boolean

Short assignment

Constant

if condition

for loop

switch

switch with fallthrough

switch default

break in for loop

continue in for loop

Array

Slice

Channel - Buffered

Channel - Unbuffered

function

init()

init() order - multiple files


Closure

defer

Error

Goroutines

Interface

map

Pointers

range

return

struct

struct embedding

JSON

UTF-8

Variadic arguments

String replace

Web

Top comments (0)