Expression
Constant expressions
Constant arithmetic is evaluated at compile time rather than using ordinary fixed-width variables. Only permitted operations and certain built-ins yield constants; ordinary function calls do not. Example output: '4'.
Formal Syntax & Structure
go syntaxgo
const Name = expressionWorking Example
Example Snippetgo
package main
import "fmt"
func main() { const huge = 1 << 100 const small = huge >> 98 fmt.Println(small)}