Rust - Variables
Variables
To declare a variable we can simply use as below:
let var = 2;
to define the variable type
let var:i32 = 2;
the variable var will be defined as i32 type.
for multiple variables
let (var1, var2) = (8,30); -- tple patrens
Variable are immutables by default unless we specify as a table like,
the above variable var can not be changed by default.
let mut var = 2;
with default immutables Safety, Concurrency, and Speed will be increased with optimization.
const PI_VALUE: f64 = 3.14;
Comments
Post a Comment