On Wednesday, 22 July 2015 at 20:59:11 UTC, Adam D. Ruppe wrote:
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);
That's what the ternary expression is for:
auto a = e ? c : d;
Though the ternary is unnecessary with statements as
expressions, common cases like this are handled.
:) The example was written to save space. I recon you understand
what I mean.