Constants can be confusing and easy to misuse in Go if you are coming from an untyped language. Let’s take a look at some of the nuanced details of how they work in Go. It’s probably unsurprising, but Go’s constants are almost nothing like JavaScript’s bastardized version of the concept.
Many programming languages support constants, often denoted by the keyword const
.
Go and JavaScript both declare new constants in the same way:
const frameRate = 60
#languages #clean code #engineering practices #golang #javascript #compile #const #constant #global #go #golang #javascript