On Wednesday, 22 July 2015 at 20:43:04 UTC, simendsjo wrote:
When "everything" is an expressions, you can write things like auto a = if(e) c else d;In D you have to write type a = invalid_value; if(e) a = c; else a = d; assert(a != invalid_value);
I prefer this example from one of the various Rust tutorials
let foo = if x == 5 {
"five"
}
else if x == 6 {
"six"
}
else {
"neither"
}
You're basically using a conditional expression as an rvalue. You
can do the same thing with a { } block.
