Created
May 19, 2015 05:41
-
-
Save ralexstokes/bcfa5605e787fdb90a9b to your computer and use it in GitHub Desktop.
if.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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