Skip to content

Instantly share code, notes, and snippets.

@ruimo
Created February 25, 2020 08:18
Show Gist options
  • Save ruimo/832ce92e9c90d60e647a8b2cf3f3533a to your computer and use it in GitHub Desktop.
Save ruimo/832ce92e9c90d60e647a8b2cf3f3533a to your computer and use it in GitHub Desktop.
fn longer<'a>(s0: &'a str, s1: &'a str) -> &'a str {
if s0.len() > s1.len() {
s0
} else {
s1
}
}
fn main() {
let s0 = "Hi";
let s1 = "Low";
println!(
"longer: {}",
longer(s0, s1)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment