go constant
Constant in Go Language
package main
import "fmt"
func main() {
const pi = 3.14
fmt.Println("The value of pi is", pi)
}
In this example, we declare a constant named "pi" with the value 3.14 using the const
keyword. We then use the fmt
package to print the value of pi to the console. When a constant is declared in Go using the const
keyword, its value cannot be changed throughout the program.