Created
September 9, 2020 15:31
-
-
Save Agilulfe/5596835a314423cc746c8a7426130dbe to your computer and use it in GitHub Desktop.
Variables tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
var y = "Hello, Scope!" | |
func main() { | |
var x string | |
x = "Hello, World!" | |
fmt.Println(x) | |
const pi float64 = 3.1416 | |
fmt.Println(pi) | |
var ( | |
first = "I" | |
second = "love" | |
third = "Go." | |
) | |
fmt.Println(first, second, third) | |
fmt.Println(y) | |
testScope() | |
} | |
func testScope() { | |
fmt.Println(y, "test") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment