Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Values

Here are some basic built-in types, and the syntax for literal values of each type.

TypyLiterały
Liczby całkowite ze znakiemi8, i16, i32, i64, i128, isize-10, 0, 1_000, 123_i64
Liczby całkowite bez znakuu8, u16, u32, u64, u128, usize0, 123, 10_u16
Liczby zmiennoprzecinkowef32, f643.14, -10.0e20, 2_f32
Wartości skalarne Unicodechar'a', 'α', '∞'
Logicznebooltrue, false

Typy mają następujące rozmiary:

  • iN, uN i fN mają wielkość N bitów,
  • isize i usize mają wielkość wskaźnika,
  • char is 32 bits wide,
  • bool is 8 bits wide.
This slide should take about 10 minutes.

There are a few syntaxes which are not shown above:

  • All underscores in numbers can be left out, they are for legibility only. So 1_000 can be written as 1000 (or 10_00), and 123_i64 can be written as 123i64.