From aef8d25a920d068869be675796cf578544c7d277 Mon Sep 17 00:00:00 2001 From: headdetect Date: Mon, 3 Aug 2020 06:19:23 -0600 Subject: [PATCH] go: Update "statements in if" use case (#1199) Co-authored-by: Rico Sta. Cruz --- go.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.md b/go.md index 581521d93..fdc212350 100644 --- a/go.md +++ b/go.md @@ -184,13 +184,13 @@ See: [If](https://tour.golang.org/flowcontrol/5) ### Statements in if ```go -if _, err := getResult(); err != nil { +if _, err := doThing(); err != nil { fmt.Println("Uh oh") } ``` {: data-line="1"} -A condition in an `if` statement can be preceded with a statement before a `;`. +A condition in an `if` statement can be preceded with a statement before a `;`. Variables declared by the statement are only in scope until the end of the `if`. See: [If with a short statement](https://tour.golang.org/flowcontrol/6)