From 75364935985d41fea801f90106c8a8313d35c285 Mon Sep 17 00:00:00 2001 From: Aditya Sood Date: Sun, 16 Oct 2022 20:25:06 +0530 Subject: [PATCH] Minor addition to if-else text on declarations Extremely minor addition to if-else text on declarations preceding conditionals, by explicitly clarifying that variables declared are only available in branches succeeding the declaration, not all the branches in the if-else ladder (i.e. preceding branches will not have it in their scope) This edit might be redundant since variables in Golang can only be used after declaration, but to a complete novice the original wording of "...any variables declared in this statement are available in *all* branches..." might be a little misleading and appear to say that the variable is in-scope for the preceding branches as well (as this seems to be a very Golang-specific semantic that other high-level languages like C/C++, Java, Scala, Kotlin etc don't support; and so it will be a brand new paradigm for developers coming from such languages). Thanks! --- public/if-else | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/if-else b/public/if-else index b05329e..671ab8d 100644 --- a/public/if-else +++ b/public/if-else @@ -105,7 +105,7 @@ straight-forward.

A statement can precede conditionals; any variables -declared in this statement are available in all +declared in this statement are available in the current and all the succeeding branches.