lean into examples
This commit is contained in:
14
examples/variables/variables.go
Normal file
14
examples/variables/variables.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// `var` declares 1 or more variables. The type comes
|
||||
// at the end.
|
||||
var x string = "Hello world"
|
||||
fmt.Println(x)
|
||||
|
||||
// An example of declaring multiple `int` variables.
|
||||
var a, b int = 1, 2
|
||||
fmt.Println(a, b)
|
||||
}
|
||||
3
examples/variables/variables.sh
Normal file
3
examples/variables/variables.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
$ go run variables.go
|
||||
Hello world
|
||||
1 2
|
||||
Reference in New Issue
Block a user