ds-learn-rust 0.1.1

Code that I wrote while learning Rust from the Rust Book
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
fn longest<'a>(x: &'a String, y: &'a String) -> &'a String {
    if x.len() > y.len() {
        x
    } else {
        y
    }
}

pub fn ch_10_03() {
    let string1 = String::from("abcd");
    let string2 = String::from("efdddd");
    let result = longest(&string1, &string2);
    println!("The longest string is {}", result);
}