1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-12-22 06:47:49 +02:00

Publish Comprehensive Rust 🦀

This commit is contained in:
Martin Geisler
2022-12-21 16:36:30 +01:00
commit c212a473ba
252 changed files with 8047 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
# Small Example
Here is a small example program in Rust:
```rust,editable
fn main() { // Program entry point
let mut x: i32 = 6; // Mutable variable binding
print!("{x}"); // Macro for printing, like printf
while x != 1 { // No parenthesis around expression
if x % 2 == 0 { // Math like in other languages
x = x / 2;
} else {
x = 3 * x + 1;
}
print!(" -> {x}");
}
println!();
}
```