//! Lifetime examples
pub fn lifetime_examples() {
println!("\n⏰ Lifetime Examples");
println!("{}", "-".repeat(21));
let string1 = String::from("long string");
let string2 = "short";
let result = longest(&string1, string2);
println!("Longest string: {}", result);
}
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() {
x
} else {
y
}
}