Skip to content

Latest commit

 

History

History
52 lines (34 loc) · 1.54 KB

primitives.md

File metadata and controls

52 lines (34 loc) · 1.54 KB
version example_title
1.0.0
プリミティブ型

プリミティブ型

Vのプリミティブ型は、Go言語よりも少なくなっています。

基本型

  • bool型(trueまたはfalse

  • string型

  • integer型(int

  • float型(float

  • rune型(Unicodeコードポイント)-- 0xf09f9880など

複合型

  • array型([]

  • map型({}

  • struct型

integer型

integer(整数)型はさらにsigned(符号あり)とunsigned(符号なし)に分けられます。signedは正または負の値を表しますが、unsignedは正の値だけを表します。

符号あり整数

型名 サイズ 値の範囲
int8 8ビット -128 〜 27 -1
int16 16ビット -215 〜 215 - 1
int 32ビット -231 〜 231 - 1
int64 64ビット -263 〜 263 - 1
int128 128ビット -2127 〜 2127 - 1

符号なし整数

型名 サイズ 値の範囲
byte 8ビット 0 〜 27 -1
u16 16ビット 0 〜 215 - 1
u32 32ビット 0 〜 231 - 1
u64 64ビット 0 〜 263 - 1
u128 128ビット 0 〜 2127 - 1