Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
458 B

  1. package main
  2. import "fmt"
  3. func main() {
  4. itemsSold()
  5. }
  6. func itemsSold() {
  7. items := make(map[string]int)
  8. items["John"] = 41
  9. items["Celina"] = 109
  10. items["Micah"] = 24
  11. for k, v := range items {
  12. fmt.Printf("%s sold %d items and ", k, v)
  13. if v < 40 {
  14. fmt.Println("is below expectations")
  15. } else if v > 40 && v <= 100 {
  16. fmt.Println("meets expectations")
  17. } else {
  18. fmt.Println("exceeded expectations")
  19. }
  20. }
  21. }