Types
XGo has built-in support for rational numbers:
We introduce rational numbers as primitive XGo types. We use suffix r to denote rational literals. For example, 1r << 200 means a big int whose value is equal to 2^200.
By default, 1r will have the type of bigint. And 4/5r means the rational constant 4⁄5. It will have the type of bigrat.
XGo primitive types are
bool
int8 int16 int32 int int64 int128
uint8 uint16 uint32 uint uint64 uint128
uintptr (similar to C's size_t)
byte (alias for uint8)
rune (alias for int32, represents a Unicode code point)
string
float32 float64
complex64 complex128
bigint bigrat
unsafe.Pointer (similar to C's void*)
any (alias for Go's interface{})
The example shows variables of several types, and also that variable declarations may be “factored” into blocks, as with import statements.
The int, uint, and uintptr types are usually 32 bits wide on 32-bit systems and 64 bits wide on 64-bit systems. When you need an integer value you should use int unless you have a specific reason to use a sized or unsigned integer type.
Next example: Integers