-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path04_variables_constants_types.go
64 lines (53 loc) · 1.38 KB
/
04_variables_constants_types.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
// Go is a statically typed language
// You have to set the type of each variable during the compilation process
// and you can not change them at runtime
// With Go syntax you declare types either explicitly or implicitly
func main() {
// Explicit typing
var firstInteger int // the default value is 0 in this case
var secondInteger int = 42
var firstString = "This is Go!!!"
// Implicit typing
// the varible type are being inferred based on the initial values that are assigned
thirdInteger := 42
secondString := "This is Go!!!"
// constants in Go with Explicit typing
const cInteger int = 1
// constants in Go with Implicit typing
const cString = "This is Go!!!"
// fixed integer types
/*
uint8, uint16, uint32, uint64
int8, int16, int32, int64
*/
// integer aliases
/*
byte
uint -- depending on the os it might reflect the uint32 or uint64
int -- depending on the os it might reflect the int32 or int64
uintptr
*/
// float
/*
float32, float64
*/
//complex numbers
/*
complex64, complex128
*/
//Data collection types
/*
Arrays, Slices, Maps, Structs, etc.
*/
//Language organization
/*
Functions -- Function is a type in Go and that's what it makes it to pass as an argument
Interfaces
Channels
*/
//Data management
/*
Pointers -- these are reference variables that points an address in memory
*/
}