Skip to content

Instantly share code, notes, and snippets.

@jochasinga
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jochasinga/b4869567ded1be089e8b to your computer and use it in GitHub Desktop.
Save jochasinga/b4869567ded1be089e8b to your computer and use it in GitHub Desktop.
Switch in Go
package main
import "fmt"
func main() {
var input float64
fmt.Scanf("%f", &input)
switch input {
case 0: fmt.Println("Zero")
case 1: fmt.Println("One")
case 2: fmt.Println("Two")
case 3: fmt.Println("Three")
case 4: fmt.Println("Four")
case 5: fmt.Println("Five")
default: fmt.Println("Unknown Number")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment