Skip to content

Instantly share code, notes, and snippets.

@Agilulfe
Created January 1, 2021 18:47
Show Gist options
  • Save Agilulfe/98c4f90863cba88b9e5c500fff256687 to your computer and use it in GitHub Desktop.
Save Agilulfe/98c4f90863cba88b9e5c500fff256687 to your computer and use it in GitHub Desktop.
Switch statement
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