Skip to content

Instantly share code, notes, and snippets.

@loloof64
Created September 11, 2016 09:09
Show Gist options
  • Select an option

  • Save loloof64/609a98a5854d79a205ed242e1cd4a8c8 to your computer and use it in GitHub Desktop.

Select an option

Save loloof64/609a98a5854d79a205ed242e1cd4a8c8 to your computer and use it in GitHub Desktop.
How creating and swapping variables is very easy in Rust
fn main() {
let (a,b) = (10, 20);
println!("Before swapping : a = {} and b = {}.", a, b);
let (b,a) = (a,b);
println!("After swapping : a = {} and b = {}.", a, b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment