# Introduction To Numeric Constants In Go

DevFeed: [Introduction To Numeric Constants In Go](<https://devfeed.tech/articles/introduction-to-numeric-constants-in-go-22099.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2014/04/introduction-to-numeric-constants-in-go.html>)

Published: 2014-04-06T00:00:00Z

Content type: article

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [data type](<https://devfeed.tech/topics/data-type.md>), [floating-point](<https://devfeed.tech/topics/floating-point.md>)

Tags: [ardan-labs](<https://devfeed.tech/tags/ardan-labs.md>), [blog](<https://devfeed.tech/tags/blog.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [compilers](<https://devfeed.tech/tags/compilers.md>), [floating-point](<https://devfeed.tech/tags/floating-point.md>), [go](<https://devfeed.tech/tags/go.md>), [go-programming](<https://devfeed.tech/tags/go-programming.md>), [golang](<https://devfeed.tech/tags/golang.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kind](<https://devfeed.tech/tags/kind.md>), [language](<https://devfeed.tech/tags/language.md>), [programming](<https://devfeed.tech/tags/programming.md>), [rune](<https://devfeed.tech/tags/rune.md>), [type](<https://devfeed.tech/tags/type.md>), [type-safe](<https://devfeed.tech/tags/type-safe.md>), [unique](<https://devfeed.tech/tags/unique.md>), [values](<https://devfeed.tech/tags/values.md>), [variables](<https://devfeed.tech/tags/variables.md>)

## AI overview

Go numeric constants can be declared with or without an explicit type; literal values are untyped and unnamed, while declarations such as `const typedInteger int = 12345` are typed and named. The excerpt distinguishes a constant's kind from its type: a declared type applies that type's precision limits but does not determine the compiler's internal representation, which may vary. Numeric constants have integer, floating-point, complex, or rune kinds. Literal form determines whether a value is integer or floating-point: a decimal point or exponent makes it floating-point; without either, it is integer.

## Source excerpt

Introduction One of the more unique features of Go is how the language implements constants. The rules for constants in the language specification are unique to Go. They provide the flexibility Go needs at the compiler level to make the code we write readable and intuitive while still maintaining a type safe language. This post will attempt to build a foundation for what numeric constants are, how they behave in their simplest form and how best to talk about them. There are a lot of little nuances, terms and concepts that can trip us up. Because of this, the post is going to take things slowly. So if you are ready to peek under the covers just a bit, roll up your sleeve and let's get started: Untyped and Typed Numeric Constants Constants can be declared with or without a type in Go. When we declare literal values in our code, we are actually declaring constants that are both untyped and unnamed. The following examples show typed and untyped numeric constants that are both named and unnamed: