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

Jack jckj33 at gmail.com
Mon Jun 6 16:47:37 UTC 2022


On Monday, 6 June 2022 at 14:30:28 UTC, Salih Dincer wrote:
> On Saturday, 4 June 2022 at 22:21:12 UTC, Ola Fosheim Grøstad 
> wrote:
>> 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.
>
> It is so far ahead of the D era that it needs to be focused 
> on...
>
> For example (int i = 123_456_789;), the D feature that comes in 
> ES12 has been there for years, but still no async/await in ES7! 
> Anyway, will these features come one day?
>> &&=
>> ||=
>> ??=
that's really a nice set of operators to have...
> **Source:** 
> https://www.pullrequest.com/blog/javascript-es2021-you-need-to-see-these-es12-features/




More information about the Digitalmars-d mailing list