-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_hello_world.go
38 lines (34 loc) · 751 Bytes
/
01_hello_world.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
36
37
38
/*
Go program structure:
- package declaration and import
- functions
- variables
- statements and experessions
- comments
Syntax:
- tokens
- line separators
- identifiers
- keywords
- whitespaces
*/
//Every Go program is made up of packages.
//Usage of main package makes it an executable program.
package main
//Usage of packages.
//The package name is the same as the last element of the import path.
import (
"fmt"
"math"
)
//Multiple import statements look like:
//import "fmt"
//import "math"
//import "maht/rand"
func main() {
//go doc fmt Println
fmt.Println("Hello World!")
//Exported names start with a capital.
//Unexported names, lowercase, are not accessible from outsude the package
fmt.Println(math.Pi)
}