What kind of type conversion is supported by Go?

Technology CommunityCategory: GolangWhat kind of type conversion is supported by Go?
VietMX Staff asked 3 years ago

Go is very strict about explicit typing. There is no automatic type promotion or conversion. Explicit type conversion is required to assign a variable of one type to another.

Consider:

i := 55      //int
j := 67.8    //float64
sum := i + int(j) //j is converted to int