Skip to content

Instantly share code, notes, and snippets.

@jochasinga jochasinga/switch.go
Last active Aug 29, 2015

What would you like to do?
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
You can’t perform that action at this time.