Rust variables: Difference between revisions
From wikinotes
Line 11: | Line 11: | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="rust"> | <syntaxhighlight lang="rust"> | ||
let float = 3.14; // f64 | let float = 3.14; // f64 | ||
let integer = 7; // i32 | let integer = 7; // i32 | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 23:25, 29 August 2021
Assignment
let age: u8 = 200; // typed let age = 200u8; // type-suffix let age = 200; // implied type
Literals
let float = 3.14; // f64 let integer = 7; // i32
Introspection
use std::any::type_name;