This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func adder() (func(int) int) { //declare function adder() with the function literal func(int) as a parameter of type int | |
var x int | |
return func(delta int) int { | |
x += delta | |
return x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func adder() (func(int) int) { | |
var x int | |
return func(delta int) int { | |
x += delta | |
return x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func adder() (func(int) int) { | |
var x int | |
return func(delta int) int { | |
x += delta | |
return x | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
func adder() (func(int) int) { | |
var x int | |
return func(delta int) int { | |
x += delta | |
return x | |
} |
NewerOlder