Created
February 25, 2020 08:18
-
-
Save ruimo/832ce92e9c90d60e647a8b2cf3f3533a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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