go Considerations

go Language Note:
. 1, go implicit conversion is not supported (implicit conversion is to convert the type of small to large type, such as int32 int64 converted to go in an unsupported language, go all display conversion)
2, pointers are language go pointer arithmetic is not supported (such as not supported. 1 + P *)
. 3, string data type is not a reference or pointer type, initial value of the empty string ( "") instead of nil
. 4, no upstream ++ language Go , - (a + such as not), only the rear support ++ -
5, if the dimensions of the two arrays are equal, the two arrays can be compared, because the elements of the array are compared (JAVA comparison is a reference to the array), the slice is not comparable with the slice, the slice can only compare with nil
6, swich Case comes with default break, no need to write break out of the loop, case condition can be a constant or an integer multiple conditions match
7 , var a [3] int this is an array, var a [] int which is sliced, the array is a fixed length, variable length sections can be filled by a method append
8, map does not exist if the access key, initializes the return value of 0 is 0 instead of nil, ma p The value can be a way
9, go language map which built the set did not materialize set, you can map [type] bool implementation elements of uniqueness
10, when the program error error we do not want to interrupt, you can use recover recover from errors , "Let it Crash!" is the best way to restore our uncertainty errors

Guess you like

Origin www.cnblogs.com/xhhgo/p/10951548.html