Merge pull request #3274 from divayprakash/fix-go

Fix defer wording, closes #2673
This commit is contained in:
Divay Prakash 2018-10-09 23:04:02 +05:30 committed by GitHub
commit dfd9cd2285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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