Boolean type: BOOL
Length 1 bytes
Value range: True,false
Note: You cannot use a number to represent true or false
Integral type: Int
Depending on the platform may be 32 or 64 bits
8-bit integer: int8/uint8
Length: 1 bytes
Value range: -127~127,0~255
Byte byte is actually the alias of Uint8.
16-bit integer: int16/uint16
Length: 2 bytes
Value range: -32768~32768,0~65535
32-bit integer: Int32/uint32
Length: 4 bytes
Rune is Int32 's nickname.
Floating point type: Float32/float64
Length: 4 bytes/8 bytes
Decimal places: float32 accurate to 7 digits after the decimal point, float64 to 15 digits after the decimal point
The UIntPtr type that holds the pointer, divided into 32-bit or 64-bit depending on the platform
Other types:
Array struct string
Reference type:
Map Slice Chan (concurrent use)
Interface type: interface
Function Type: func (because a function can be copied to a variable)
Type 0 Value:
A value of 0 is not empty, but is a default value after a variable is declared to be of a type, typically the type of the value is 0,bool to False,string is an empty string, array words and 0 values of the group type are consistent [2]int, the initial value of the array is [0 0]
Type aliases:
To alias a type by using the type
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/86/E6/wKioL1fOX6-yol1mAAAvY8XDU18478.png-wh_500x0-wm_3 -wmp_4-s_2572708353.png "style=" Float:none; "title=" 1.png "alt=" Wkiol1fox6-yol1maaavy8xdu18478.png-wh_50 "/>
This is possible, but it is not recommended, and the type defines some other aliases (type byte64 Int64) to make the code more readable
The alias of type definition is just the same as the structure of the type, so it is necessary to do the type conversion, and the Byte rune is indeed the alias of Uint8 Int32, which can be converted to each other.
can be converted:
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/86/E7/wKiom1fOX6_ghspOAAA5Y5TkGtk677.png-wh_500x0-wm_3 -wmp_4-s_3509292787.png "title=" 2.png "style=" Float:none; alt= "Wkiom1fox6_ghspoaaa5y5tkgtk677.png-wh_50"/>
This is not possible to convert.
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/86/E6/wKioL1fOX7DDBSldAABL_Wmov2E260.png-wh_500x0-wm_3 -wmp_4-s_2980296386.png "title=" 3.png "style=" Float:none; alt= "Wkiol1fox7ddbsldaabl_wmov2e260.png-wh_50"/>
You must do an explicit type conversion to
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/86/E7/wKiom1fOX7CgZRspAAAYXXyANL4891.png-wh_500x0-wm_3 -wmp_4-s_3606092812.png "title=" 4.png "style=" Float:none; alt= "Wkiom1fox7cgzrspaaayxxyanl4891.png-wh_50"/>
This article is from the "Your Night" blog, be sure to keep this source http://lixin15.blog.51cto.com/3845983/1846831
Golang Study notes (2)---Basic type of Go language