Skip to content

Instantly share code, notes, and snippets.

@filipearray
Created May 12, 2024 20:54
Show Gist options
  • Save filipearray/d79d9e8c52d6808e82fbf8fbe5a498d6 to your computer and use it in GitHub Desktop.
Save filipearray/d79d9e8c52d6808e82fbf8fbe5a498d6 to your computer and use it in GitHub Desktop.
Party Robot
package partyrobot
import "fmt"
// Welcome greets a person by name.
func Welcome(name string) string {
return fmt.Sprintf("Welcome to my party, %s!", name)
}
// HappyBirthday wishes happy birthday to the birthday person and exclaims their age.
func HappyBirthday(name string, age int) string {
return fmt.Sprintf("Happy birthday %s! You are now %d years old!", name, age)
}
// AssignTable assigns a table to each guest.
func AssignTable(name string, table int, neighbor, direction string, distance float64) string {
return fmt.Sprintf("Welcome to my party, %s!\nYou have been assigned to table %03d. Your table is %s, exactly %.1f meters from here.\nYou will be sitting next to %s.", name, table, direction, distance, neighbor)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment