flâneur — a map of the web's best reading

Constants - The Go Programming Language

go.dev · 3,984 words · saved by 1 readers

An introduction to constants in Go.

Constants - The Go Programming Language The Go Blog Constants Rob Pike 25 August 2014 Introduction Go is a statically typed language that does not permit operations that mix numeric types. You can't add a float64 to an int , or even an int32 to an int . Yet it is legal to write 1e6*time.Second or math.Exp(1) or even 1<<(' '+2.0) . In Go, constants, unlike variables, behave pretty much like regular numbers. This post explains why that is and what it means. Background: C In the early days of thinking about Go, we talked about a number of problems caused by the way C and its descendants let you m

Explore this link on the map →

related reading