Skip to content

Instantly share code, notes, and snippets.

@ralexstokes
Created May 19, 2015 05:41
Show Gist options
  • Save ralexstokes/bcfa5605e787fdb90a9b to your computer and use it in GitHub Desktop.
Save ralexstokes/bcfa5605e787fdb90a9b to your computer and use it in GitHub Desktop.
if.rs
fn foo() {
let y = if true { 4 } else { 10 };
println!("{}", y);
}
// fails; returns () from if expression, compiler suggests an else is missing
fn bar() {
let y = if true { 5 };
println!("{}", y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment