From b92a3544f524255a8a3a72d9745d972e4346996c Mon Sep 17 00:00:00 2001 From: ibalbaert Date: Sat, 30 Nov 2019 09:18:06 +0100 Subject: [PATCH] docs: fix interfaces example --- doc/docs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index e7542fef13..59e96ab556 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -885,14 +885,14 @@ interface Speaker { speak() string } -fn perform(s Speaker) { - println(s.speak()) +fn perform(s Speaker) string { + return s.speak() } dog := Dog{} cat := Cat{} -perform(dog) // "woof" -perform(cat) // "meow" +println(perform(dog)) // "woof" +println(perform(cat)) // "meow" ``` A type implements an interface by implementing its methods.