Rust learning: lessons, notes, and exercise crates

This commit is contained in:
2026-09-06 23:59:08 +07:00
commit 6ddf41aa81
119 changed files with 10873 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/target
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "variables"
version = "0.1.0"
+6
View File
@@ -0,0 +1,6 @@
[package]
name = "variables"
version = "0.1.0"
edition = "2024"
[dependencies]
+26
View File
@@ -0,0 +1,26 @@
fn main() {
let mut x = 5;
println!("the value of x is {x}");
x = 3;
{
let x = x * 2;
println!("The value of x in the inner scope is: {x}");
}
println!("the value of x is {x}");
const THREE_HOURS_IN_SECONDS: u32 = 60 * 60 * 3;
let tup: (i32, f64, u8) = (500, 6.4, 1);
let (x, y, z) = tup;
let a: [i32; 5] = [1, 2, 3, 4, 5];
let b: [i32; 5] = [0; 5];
println!("number {}", tup.0);
another();
}
fn another() {
println!("another one");
}