if, switch, goto / switch statement / Essential Go

Run Settings
LanguageGo
Language Version
Run Command
package main import ( "fmt" ) func printType(iv interface{}) { // inside case statements, v is of type matching case type switch v := iv.(type) { case int: fmt.Printf("'%d' is of type int\n", v) case string: fmt.Printf("'%s' is of type string\n", v) case float64: fmt.Printf("'%f' is of type float64\n", v) default: fmt.Printf("We don't support type '%T'\n", v) } } func main() { printType("5") printType(4) printType(true) }
Editor Settings
Theme
Key bindings
Full width
Lines