Skip to content

Commit

Permalink
Update closures.gop
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei authored Oct 13, 2023
1 parent 8e06a0a commit 1f09036
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 205-Closures/closures.gop
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//Go functions may be closures. A closure is a function value that references variables from outside its body.
//Go+ functions may be closures. A closure is a function value that references variables from outside its body.
//The function may access and assign to the referenced variables; in this sense the function is "bound" to the variables.
//For example, the adder function returns a closure. Each closure is bound to its own sum variable.

Expand All @@ -14,4 +14,4 @@ pos, neg := adder(), adder()
for i := 0; i < 10; i++ {
println pos(i), neg(-2*i)

}
}

0 comments on commit 1f09036

Please sign in to comment.