Thanks for the excellent replies.
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote:
Some languages support this kind of thing:
if ((var x = expression) > 50)
print(x, " is > 50")
Is there anything similar in D?
Yes assuming that the expression is bool evaluable. This includes
- pointers: `if (auto p =
On Friday, 7 February 2020 at 08:52:44 UTC, mark wrote:
Some languages support this kind of thing:
if ((var x = expression) > 50)
print(x, " is > 50")
Is there anything similar in D?
Yes and no.
It only works for bools or things that convert to bool.
You might have seen:
string[string]
Some languages support this kind of thing:
if ((var x = expression) > 50)
print(x, " is > 50")
Is there anything similar in D?