mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
Updated InterfaceSlice (markdown)
parent
8b01addc5a
commit
8ae9118961
@ -36,7 +36,7 @@ If you really want a ` []interface{} ` because you'll be doing indexing before c
|
||||
```go
|
||||
var dataSlice []int = foo()
|
||||
var interfaceSlice []interface{} = make([]interface{}, len(dataSlice))
|
||||
for i, d := range dataSlice {
|
||||
interfaceSlice[i] = d
|
||||
for i := range dataSlice {
|
||||
interfaceSlice[i] = dataSlice[i]
|
||||
}
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user