diff --git a/04-Fundamentals-II/05_Interfaces/Interfaces.md b/04-Fundamentals-II/05_Interfaces/Interfaces.md index dacdb74..8d7690d 100644 --- a/04-Fundamentals-II/05_Interfaces/Interfaces.md +++ b/04-Fundamentals-II/05_Interfaces/Interfaces.md @@ -42,7 +42,7 @@ In combination with type switch, a generic-like behavior can be implemented. Please remember: value.(type) is a cast to the type "type" ```golang -func DoStuff(value interface) { +func DoStuff(value interface{}) { switch t := value.(type) { case int64: { @@ -53,6 +53,18 @@ func DoStuff(value interface) { } ``` +# Interface as type + +```golang + +var x interface{} + +x = "a string" + +fmt.Printn(x) + +``` + ## Pro Tip