Skip to content

Instantly share code, notes, and snippets.

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