Skip to content

Instantly share code, notes, and snippets.

@ruimo
Created February 25, 2020 08:16
Show Gist options
  • Save ruimo/0f234729ff0520e3c1fe0e741e70a893 to your computer and use it in GitHub Desktop.
Save ruimo/0f234729ff0520e3c1fe0e741e70a893 to your computer and use it in GitHub Desktop.
fn longer(s0: &str, s1: &str) -> &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