Last active
August 29, 2015 14:07
-
-
Save jochasinga/b4869567ded1be089e8b to your computer and use it in GitHub Desktop.
Switch in Go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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