We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2d52974 commit 04a5d47Copy full SHA for 04a5d47
var.go
@@ -0,0 +1,18 @@
1
+// variable scope
2
+// In golang scope is defined as block. A block is a possibly empty sequence of declaration and statements within matching curly bracke
3
+// In golang there are two types of block inner block and outer block
4
+// Inner block can access the variables that are declared in the outer block
5
+// Outer block cannot access the variables that are declared in the inner block.
6
+package main
7
+
8
+import "fmt"
9
10
+func main() {
11
+ city := "London"
12
+ {
13
+ country := "UK"
14
+ fmt.Println(city)
15
+ fmt.Println(country)
16
+ }
17
18
+}
0 commit comments