Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions practice/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,5 @@ import (
)

func main() {
poodle := Dog{"Poodle", 10, "Woof!"}
fmt.Println(poodle)
fmt.Printf("%+v\n", poodle)
fmt.Printf("Breed: %v\nWeight: %v\n", poodle.Breed, poodle.Weight)

poodle.Speak()
poodle.Sound = "Arf!"
poodle.Speak()
poodle.SpeakThreeTimes()
poodle.SpeakThreeTimes()
}

// Dog is a struct
type Dog struct {
Breed string
Weight int
Sound string
}

// Speak is how the dog speaks
func (d Dog) Speak() {
fmt.Println(d.Sound)
}

// SpeakThreeTimes is how the dog speaks loudly
func (d Dog) SpeakThreeTimes() {
d.Sound = fmt.Sprintf("%v %v %v", d.Sound, d.Sound, d.Sound)
fmt.Println(d.Sound)
fmt.Println("Files")
}