mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-13 18:24:39 +02:00
Merge pull request #664 from petehamilton/patch-1
Remove duplication of function factory example
This commit is contained in:
@@ -214,13 +214,6 @@ func sentenceFactory(mystring string) func(before, after string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next two are equivalent, with second being more practical
|
|
||||||
fmt.Println(learnFunctionFactory("summer")("A beautiful", "day!"))
|
|
||||||
|
|
||||||
d := learnFunctionFactory("summer")
|
|
||||||
fmt.Println(d("A beautiful", "day!"))
|
|
||||||
fmt.Println(d("A lazy", "afternoon!"))
|
|
||||||
|
|
||||||
func learnDefer() (ok bool) {
|
func learnDefer() (ok bool) {
|
||||||
// Deferred statements are executed just before the function returns.
|
// Deferred statements are executed just before the function returns.
|
||||||
defer fmt.Println("deferred statements execute in reverse (LIFO) order.")
|
defer fmt.Println("deferred statements execute in reverse (LIFO) order.")
|
||||||
|
Reference in New Issue
Block a user