converting types to custom type in go

tags: learning go programming

content

type MyInt int
type NormalInt = int
 
myInt := MyInt(1)
normalInt := NormalInt(myInt)
 
fmt.Printf("%T\n", myInt)      // prints main.MyInt
fmt.Printf("%T\n", normalInt)  // prints int
 

up

down

reference