diff --git a/public/variables b/public/variables index 736c7c4..7bf1c69 100644 --- a/public/variables +++ b/public/variables @@ -154,7 +154,7 @@ initializing a variable, e.g. for - +
$ go run variables.go
 initial
@@ -165,6 +165,21 @@ initializing a variable, e.g. for
           
         
         
+        
+          
+            

The shorthand := initialization of variable can +only be used inside any function. +If used outside any function, it would generate +syntax error: non-declaration statement outside +function body.

+ + + + + + + + @@ -180,7 +195,7 @@ initializing a variable, e.g. for