named type

A new type you declare with the type keyword, based on an existing one, such as type state int.

In more detail

The new type has the same underlying data but is distinct to the compiler, so a state cannot be mixed with a plain int by accident. You can attach methods to it. Structs and interfaces are usually declared this way too.

Example

type state int

Related terms

Taught in

References