mainfunction as your entry point.
:=operator which can infer the type and assign it to a variable at the same time. Using it we can write the same example as above and omit the
breakkeyword, this will print 0 to 4.
(p Person)part. This basically says that the type that can receive this method call is of type
Personand that within that function we want to name that receiver
Eaters in the
printEatResultfunction. Notice how we didn't have to do anything to explicitly say that Cats and Dogs implement the Eater interface, the compiler just figured it out because the signature of the
eatfunction on each of those structs matched the
Eater's version of it.
eat) to end with the name of that method plus