|
Size: 1159
Comment:
|
Size: 607
Comment: Rewrite
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| = Go Data Types = | = Go Numerics = Go offers several '''numerics''' defined by their size and behavior. |
| Line 9: | Line 11: |
| == String == | == Description == |
| Line 11: | Line 13: |
| A `string` is an immutable container of `uint8` bytes. They are meant to represent text encoded in UTF-8, but not every byte is guaranteed to be valid Unicode. There are only a few instances where strings are implicitly encoded: * in `for i, r := range s`, the `r` is a Unicode rune * in `rs := []rune(s)`, `rs` is a string of Unicode runes In these cases, all invalid Unicode bytes are converted to `U+FFFD` (the replacement character). ---- == Bool == ---- == Numeric Types == |
The integer types are: |
| Line 35: | Line 18: |
| * floating point numbers: `float32` and `float64` * complex numbers: `complex64` and `complex128` |
|
| Line 38: | Line 19: |
| `byte` is an alias to `uint8`, and `rune` is an alias to `int32`. | There are also two floating point types defined by size: `float32` and `float64`. |
| Line 40: | Line 21: |
| ---- | Lastly, there are two complex types defined by size: `complex64` and `complex128`. |
| Line 42: | Line 23: |
== Pointer == ---- == Struct == ---- == Function == ---- == Container Types == * `array` * `slice` * `map` ---- == Channel == ---- == Interface == |
Note that `byte` is an alias to `uint8`, and `rune` is an alias to `int32`. |
Go Numerics
Go offers several numerics defined by their size and behavior.
Contents
Description
The integer types are:
signed integers: int8, int16, int32, int64, and int
unsigned integers: uint8, uint16, uint32, uint64, and uint
uintptr
There are also two floating point types defined by size: float32 and float64.
Lastly, there are two complex types defined by size: complex64 and complex128.
Note that byte is an alias to uint8, and rune is an alias to int32.
