String formatting



examples/other/string-formatting/src/main.rs
fn main() {
    let name = "Foo";
    let text1 = format!("Hello {}, how are you?", name);
    let text2 = format!("Hello {name}, how are you?");
    println!("{}", text1);
    println!("{}", text2);
}

examples/other/reverse/src/main.rs
fn main() {
    let text = "Hello";
    println!("{}", text);
    let reversed = reverse(text);
    println!("{}", text);
    println!("{}", reversed);
}

fn reverse(text: &str) -> String {
    let reversed: String = text.chars().rev().collect();
    reversed
}

Hello
Hello
olleH


examples/other/collect/src/main.rs
fn main() {
    let characters = ('a', 'b');
    println!("{:?}", characters);

    let strings = ("a", "b");
    println!("{:?}", strings);
    // println!("{:?}", letters.collect());
    println!("Hello");
    // println!('Hello'); // error: character literal may only contain one codepoint
}