mirror of
https://github.com/traefik/yaegi.git
synced 2026-06-01 18:37:56 +00:00
24 lines
267 B
Go
24 lines
267 B
Go
package main
|
|
|
|
type Sample struct {
|
|
Name string
|
|
Foo []string
|
|
}
|
|
|
|
func (s *Sample) foo(j int) {
|
|
for i, v := range s.Foo {
|
|
println(i, v)
|
|
}
|
|
}
|
|
|
|
var samples = []Sample{
|
|
Sample{"hello", []string{"world"}},
|
|
}
|
|
|
|
func main() {
|
|
samples[0].foo(3)
|
|
}
|
|
|
|
// Output:
|
|
// 0 world
|