
π This article includes 1 downloadable practice file β
let rate: f64 = 60.0; // immutable
let mut passed = 0; // mutable
for m in [78, 91, 45, 33] { if m >= 40 { passed += 1; } }
let amount = 12_u32 as f64 * rate;
println!("{amount:.2}");
Immutability by default prevents accidental changes. Types: i32/u32 integers, f64 decimals, bool, &str (borrowed text) and String (owned, growable text).
π‘ Let the compiler teach you: Rust’s error messages usually say exactly what to change.
Code for this course follows standard, current syntax; we test JavaScript and PowerShell scripts before publishing, and R/Java/Rust examples are kept to core language features. Tell us if anything fails on your setup.
Practice
Change a variable without mut and read the compiler message.
π Practice files for this article
- πrust-hello-main.rsLesson code file.β¬ RS Β· 327 B
Free to use for learning. Files with macros (.bas) are plain text β import them with Alt+F11 β File β Import File, and always test on a copy.
β¨ Ask AI about this article
Stuck on a step? Ask a question and the AI answers using this article.
Free Β· AI can be wrong