Welcome To Golang By Example

Declaring a constant in Go (Golang)

A constant is anything that doesn’t change its value. In Go const can be either of type string, numeric, boolean, and characters.

A constant can be declared using the const keyword. An important point to be noted is that the value has to be assigned while declaring a constant. It is unlike variables where value can be assigned later.

const c string = "circle"
const c = "circle"
const (
  c = "circle"
  s = "square"
)