Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
- if x.len() > y.len() {
- x
- } else {
- y
- }
- }
- fn main() {
- {
- let x = String::from("3");
- let z2;
- {
- let y = String::from("40");
- let z = longest(&x, &y);
- z2 = longest(&x, &y);
- println!("{:?}", z);
- }
- println!("{:?}", z2);
- }
- }
Add Comment
Please, Sign In to add comment