Rust variables: Difference between revisions

From wikinotes
Line 19: Line 19:
<blockquote>
<blockquote>
<syntaxhighlight lang="rust">
<syntaxhighlight lang="rust">
use std::any::type_name;
// use std::any::type_name; (todo - learn)
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Introspection -->
</blockquote><!-- Introspection -->

Revision as of 23:26, 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;  (todo - learn)