Do you think if statement as expression would be nice to have in D?
forkit
forkit at gmail.com
Sat Jun 4 05:13:14 UTC 2022
On Friday, 3 June 2022 at 18:33:57 UTC, Jack wrote:
> Rust does support it like that:
>
> ```rust
> const limit:i32 = 30;
> let n = 10;
> let mut r = if n > limit { "big" } else { "small "};
> println!("{} is {} than {}", n, r, limit);
> ```
>
> do you think would be nice that in D as well? I find it can
> increase code reability...
According to the policy laid down by Mike (in another post), it
must provide a 'strong benefit', not just be something that is
useful to increase code reliabiltiy/readability.
It is neither useful, nor a strong benefit, to me ;-)
More information about the Digitalmars-d
mailing list