Golang: Semicolon

By Xah Lee. Date: .

Semicolon is used in golang to separate statements.

When a statement is on a line by itself, semicolon is optional.

For example, the following are equivalent:

import ( "fmt"; "os"; )
import (
	"fmt"
	"os"
)

Golang

Compile and Run

String

Types and Values

Branching and Loop

Data Structure

Function

Misc

Examples

Reference