Created
January 1, 2021 18:47
-
-
Save Agilulfe/98c4f90863cba88b9e5c500fff256687 to your computer and use it in GitHub Desktop.
Switch statement
This file contains 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 preference string | |
fmt.Scanln(&preference) | |
switch preference { | |
case "meat": | |
fmt.Println("You will receive a menu for the meat") | |
case "fish": | |
fmt.Println("You will receive a menu for the fish") | |
case "seafood": | |
fmt.Println("You will receive the seafood menu") | |
case "pizza": | |
fmt.Println("You will receive a menu for the pizzas") | |
case "vegan": | |
fmt.Println("You will receive a vegan menu") | |
default: | |
fmt.Println("You will receive the complete menu") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment