Predict the output of the following code snippet.
func main() { var X interface{} switch i := X.(type){ case nil: fmt.Printf("X is :%T",i) case int: fmt.Printf("X is int") case float64: fmt.Printf("X is float64") case func(int) float64: fmt.Printf("X is func(int)") case bool, string: fmt.Printf("X is bool or string") default: fmt.Printf("Don't Know") } }
Options
- X is int
- X is bool or string
- X is func(int)
- X is :<nil>