From 772a43c21e78afdae87cb718898be6288b98ac0d Mon Sep 17 00:00:00 2001 From: Fabio Montefuscolo Date: Mon, 11 Mar 2024 17:30:09 +0100 Subject: [PATCH] learning about golang variables --- src/03-variables.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/03-variables.go diff --git a/src/03-variables.go b/src/03-variables.go new file mode 100644 index 0000000..9f98f90 --- /dev/null +++ b/src/03-variables.go @@ -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) +}