Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
14
Task/Closures-Value-capture/Go/closures-value-capture-2.go
Normal file
14
Task/Closures-Value-capture/Go/closures-value-capture-2.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fs := make([]func() int, 10)
|
||||
for i := range fs {
|
||||
fs[i] = func() int {
|
||||
return i * i
|
||||
}
|
||||
}
|
||||
fmt.Println("func #0:", fs[0]())
|
||||
fmt.Println("func #3:", fs[3]())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue