Do you think if statement as expression would be nice to have in D?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Jun 4 22:21:12 UTC 2022


On Saturday, 4 June 2022 at 22:05:36 UTC, JN wrote:
> I like the Python version of it with is reordered compared to 
> Rust/D:
>
> num_type = "even" if a % 2 = 0 else "odd"

Yes, this is one is working well when the leftmost is the most 
common case and the right one is a fallback.



More information about the Digitalmars-d mailing list