Skip to content

Instantly share code, notes, and snippets.

@rabestro
Created July 17, 2023 08:22
Show Gist options
  • Save rabestro/b9e6d674a705f00fc32197afc00f65d5 to your computer and use it in GitHub Desktop.
Save rabestro/b9e6d674a705f00fc32197afc00f65d5 to your computer and use it in GitHub Desktop.
Bob - bob.go
// Package bob implements a solution for the bob exercise from the Exercism Go track.
package bob
// Hey takes a message as input, and returns Bob's response to that remark.
func Hey(message string) string {
remark := newRemark(message)
switch {
case remark.isSilence():
return "Fine. Be that way!"
case remark.isExasperated():
return "Calm down, I know what I'm doing!"
case remark.isShouting():
return "Whoa, chill out!"
case remark.isQuestion():
return "Sure."
default:
return "Whatever."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment