From 00c4faf11ec3150c7af5b191c1829e8c6b283518 Mon Sep 17 00:00:00 2001 From: "grejo.j" Date: Wed, 14 Dec 2022 16:12:33 +0530 Subject: [PATCH] docs: addition to variables page --- public/variables | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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