Info
This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Let and let mut
fn main() {
let length = 10;
let mut width = 5;
println!(
"The oringinal dimensions are length = {} and width = {}",
length, width
);
width = width + 3;
let length = length * 2;
println!(
"The new dimensions are length = {} and width {}.",
length, width
);
}
Output:
The oringinal dimensions are length = 10 and width = 5
The new dimensions are length = 20 and width 8.
Errors:
Compiling playground v0.0.1 (/playground)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.65s
Running `target/debug/playground`
4 posts - 3 participants
🏷️ Rust_feed