Rust datatypes: Difference between revisions
From wikinotes
(Created page with " = Primitives = <blockquote> == Text == <blockquote> === char === <blockquote> <syntaxhighlight lang="rust"> char </syntaxhighlight> </blockquote><!-- char --> </blockquote><!...") |
|||
Line 16: | Line 16: | ||
=== Integers === | === Integers === | ||
<blockquote> | <blockquote> | ||
integers and floats can be typed: | |||
* using implied type <code>let var = 12;</code> | |||
* by assignment <code>let var: i8 = 12;</code> | |||
* using suffix <code>let var = 12i8;</code> | |||
<syntaxhighlight lang="rust"> | <syntaxhighlight lang="rust"> | ||
i8 | i8 |
Revision as of 22:04, 29 August 2021
Primitives
Text
char
char
Numbers
Integers
integers and floats can be typed:
- using implied type
let var = 12;
- by assignment
let var: i8 = 12;
- using suffix
let var = 12i8;
i8 i16 i32 i64 i128 isizeFloating Point
Boolean
true false
Collections
tuples
arrays