Golang Constant

Last Updated: September 13, 2022

Go supports constants of character, string, boolean, and numeric values.

const declare a constant in GO language

package main

import (
    "fmt"
    "math"
)

const strconstant string = "constant"

func main() {
    fmt.Println(strconstant)

    const n = 500000000

    const pi = 22 / 7
    fmt.Println(pi)

    
}
Test