daily pastebin goal
33%
SHARE
TWEET

Untitled

a guest Feb 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fn main() {
  2.    let x = "hi";
  3.    let y = "world";
  4.    let z = "b".to_string();
  5.  
  6.    let res: &'static str = longest(x, y, &z);
  7.  
  8.    println!("{}", res);
  9. }
  10.  
  11. // change z to &'b str to make this work
  12. fn longest<'a, 'b>(x: &'a str, y: &'a str, z: &'a str) -> &'a str {
  13.     println!("{}", z);
  14.     if x.len() > y.len() {
  15.         x
  16.     } else {
  17.         y
  18.     }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top