Advertisement
Spocoman

09. Fruit or Vegetable

Sep 18th, 2024
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.38 KB | None | 0 0
  1. package main
  2. import "fmt"
  3.  
  4. func main() {
  5.     var product string
  6.     fmt.Scanln(&product)
  7.    
  8.     switch (product) {
  9.         case "banana", "apple", "kiwi", "cherry", "lemon", "grapes":
  10.             fmt.Println("fruit")
  11.         case "tomato", "cucumber", "pepper", "carrot":
  12.             fmt.Println("vegetable")
  13.         default:
  14.             fmt.Println("unknown")
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement