learning about golang variables
This commit is contained in:
parent
71915cf8f2
commit
772a43c21e
1 changed files with 26 additions and 0 deletions
26
src/03-variables.go
Normal file
26
src/03-variables.go
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var a = "initial"
|
||||||
|
fmt.Println(a)
|
||||||
|
|
||||||
|
a = "changed"
|
||||||
|
fmt.Println(a)
|
||||||
|
|
||||||
|
var b, c int = 1, 2
|
||||||
|
fmt.Println("b=", b, ", c=", c)
|
||||||
|
|
||||||
|
var d = true
|
||||||
|
fmt.Println(d)
|
||||||
|
|
||||||
|
var e int
|
||||||
|
fmt.Println(e)
|
||||||
|
|
||||||
|
f := "short"
|
||||||
|
fmt.Println(f)
|
||||||
|
|
||||||
|
f = "changed short"
|
||||||
|
fmt.Println(f)
|
||||||
|
}
|
Loading…
Reference in a new issue