23.01 Variables and Data Types
Variables and Data Types
Overview
Rust provides strong static typing and allows variable declarations with or without mutability.
Topics
- Immutable and Mutable Variables
- Scalar Types (integer, floating-point, char, bool)
- Compound Types (tuples, arrays)
Examples
let x = 5; // Immutable
let mut y = 10; // Mutable
y += 5;
let tuple: (i32, f64, char) = (42, 3.14, 'a');
let array: [i32; 3] = [1, 2, 3];