Fix defer wording, closes #2673

This commit is contained in:
Divay Prakash 2018-10-09 22:59:19 +05:30
parent 93fc04dbb3
commit ff06f9cf99

View File

@ -277,7 +277,8 @@ func sentenceFactory(mystring string) func(before, after string) string {
} }
func learnDefer() (ok bool) { func learnDefer() (ok bool) {
// Deferred statements are executed just before the function returns. // A defer statement pushes a function call onto a list. The list of saved
// calls is executed AFTER the surrounding function returns.
defer fmt.Println("deferred statements execute in reverse (LIFO) order.") defer fmt.Println("deferred statements execute in reverse (LIFO) order.")
defer fmt.Println("\nThis line is being printed first because") defer fmt.Println("\nThis line is being printed first because")
// Defer is commonly used to close a file, so the function closing the // Defer is commonly used to close a file, so the function closing the