This is a creation in Article, where the information may have evolved or changed.
1, Go is a compiled language, but the compilation speed is very fast, let people feel is an interpreted language.
2. The go variable is known as the Var name type, such as Var a int. The type of the variable is placed after the variable name.
3, Go's fame and assignment are separate. But if a: = 15 can be used in a function to both declare and assign a variable, the type of the variable is inferred from the given value.
4, go variables are automatically initialized to null.
5, multiple Var can be a group, such as VAR (x int
y bool
)
6, the same type of variables can also be in a row to complete the fame, such as Var x, y int, variable names with ', ' separated, similar to x, y: = 2,3 is also possible.
7. There is a special variable ' _ ' in Go, and any value given to it will be discarded.
8, go to any of the famous but not used variables error.
9. Mixed variable type is illegal
10. Const is used to declare constants, such as Cosnt x=1, as opposed to Var (representing variables). Constants can only be numbers, Boolean values, or strings. You can specify a constant type when you declare a constant, such as a const x string = "0"
11. The Iota function is used to get the enumeration value, starting with 0
12, go Everywhere code is UTF-8, double quotation marks wrap the character sequence is a string type variable, and the single quotation mark wrapping is a character, not string
13, go the string is not modifiable, you can change the rune array, and then convert the result array into a string
14, go support the original string, "logo
15, go is native support complex number, two formats complex128 (64 bit imaginary part), complex64 (32 bit imaginary part)
16, go added built-in error type, such as Var a error defines an error type of variable, initially nil
17. Go does not support overloading of operators or methods
18, GO support goto statement
19, go does not have a comma expression, + +--and so are statements rather than expressions, so in a for if you want to use more than one variable must use equal assignment.
For example for I, J: = 0, 11; i<j; I,j: = i+1, j-1 {
}
20, support break and continue, and support the label break, can be in a multi-layered nested loop within a break to specify a hierarchy loop
21. Range returns a key-value pair iterator that can be used for slice, array, string, map, channel