Primitives

February 16, 2020 ยท View on GitHub

V has less primitive types than Go.

Basic Types

  • bool either true or false

  • string

  • integer type int

  • float type float

  • rune (Unicode string)

Compound Types

  • arrays []

  • map {}

  • struct

Integer

Integer is sub-classified into signed and unsigned. signed means positive or negative and unsigned means positive only.

Signed Integer

TypeSizeRange
int88 bits-128 to 27 -1
int1616 bits-215 to 215 - 1
int32 bits-231 to 231 - 1
int6464 bits-263 to 263 - 1
int128128 bits-2127 to 2127 - 1

Unsigned Integer

TypeSizeRange
byte8 bits0 to 27 -1
u1616 bits0 to 215 - 1
u3232 bits0 to 231 - 1
u6464 bits0 to 263 - 1
u128128 bits0 to 2127 - 1