You know that myvar
is a float64
because the variable is declared with the concrete type float64
.
If myvar
is an interface type, then you can use a type assertion to determine if the concrete value is some type.
var myvar interface{} = 12.34
if _, ok := myvar.(float64); ok {
fmt.Println("Type is float64.")
}
Try this program at https://play.golang.org/p/n5ftbp5V2Sx
solved How to find if type is float64 [closed]