package main import ( "fmt" ) func main() { i := 2 switch i { case 2: fmt.Println("Two") case 3: fmt.Println("Three") case 4: fmt.Println("Four") } } ### To run, ### copy code to buffer ### cat > /tmp/switch.go ### go run /tmp/switch.go
Go Programming Main Page