-
Notifications
You must be signed in to change notification settings - Fork 0
/
2variables.go
35 lines (30 loc) · 965 Bytes
/
2variables.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import "fmt"
var a = "this is stored in the variable a" // package scope
var b, c = "stored in b", "stored in c" // package scope
var d string // package scope
func main() {
d = "stored in d" // declaration above; assignment here; packagel scope
var e = 42 // function scope - subsequent variables have func scope:
f := 43
g := "stored in g"
j, k, l, m := 44.7, true, false, 'm' // single quotes
h, i := "stored in h", "stored in i"
n := "n" // double quotes
o := `o` // back ticks
fmt.Println("a - ", a)
fmt.Println("b - ", b)
fmt.Println("c - ", c)
fmt.Println("d - ", d)
fmt.Println("e - ", e)
fmt.Println("f - ", f)
fmt.Println("g - ", g)
fmt.Println("h - ", h)
fmt.Println("i - ", i)
fmt.Println("j - ", j)
fmt.Println("k - ", k)
fmt.Println("l - ", l)
fmt.Println("m - ", m)
fmt.Println("n - ", n)
fmt.Println("o - ", o)
}