Keyword
Go type keyword
Introduces a type definition or alias. A definition gives a distinct type identity; an alias names the identical type. Parameterized declarations support generics, with generic aliases fully supported starting Go 1.24. Example prints a converted defined type value.
Formal Syntax & Structure
go syntaxgo
type Name UnderlyingType | type Name = ExistingTypeWorking Example
Example Snippetgo
package main
import "fmt"
func main() { type Score int var s Score = 6 fmt.Println(s)}