Rust
fn main() {
println!("Hello World!");
}rustc hello.rs
./helloBasics Variables and Types?
//Can specify types, but optional
let x: i32 = 42; //i32 good for everything, long in C, int in Java, and dfault
let b: f64 = 3.14; // 64-bit float
let c: bool = true;
let d: char = 'z';
let e: &str = "Hello"; // String slice
let mut s = String::from("hello"); //String object that is mutable
s.push_str(", world!");
let pair: (char, i32) = ('a', 17)
pair.0; //a
pair.1 //17
let (_, r) = slice.split_at(middle)Lists
Control
Functions
Struct and Enum
Error Handling
Traits and Generic Types
Ownership and Borrowing
Concurrency
Modules and Crates
Last updated