Skip to content

Commit

Permalink
Update Interfaces.md
Browse files Browse the repository at this point in the history
type and additional infos about interface{}
  • Loading branch information
fratschi authored Nov 9, 2021
1 parent 67b53d0 commit 284e50f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion 04-Fundamentals-II/05_Interfaces/Interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -53,6 +53,18 @@ func DoStuff(value interface) {
}
```

# Interface as type

```golang

var x interface{}

x = "a string"

fmt.Printn(x)

```


## Pro Tip

Expand Down

0 comments on commit 284e50f

Please sign in to comment.