I am trying to find if a variable is of type float64:
package main
import ("fmt")
func main() {
myvar := 12.34
if myvar.(type) == float64 {
fmt.Println("Type is float64.")
}
}
However, it is not working and giving following error:
./rnFindType.go:6:10: use of .(type) outside type switch
./rnFindType.go:6:21: type float64 is not an expression
What is the problem and how can it be solved?