Rust
Hello World
fn main() { println!("Hello world"); }
#+RESULTS:
Hello world
Lifetimes
fn main() { let s1 = "abcd"; { let s2 = "foo"; let result = longest(s1, s2); println!("result is: {}", result); } } fn longest<'a>(x: &'a str, y: &'a str) -> &'a str { if x.len() > y.len() { x } else { y } }
#+RESULTS:
result is: abcd