Thread overview | |||||
---|---|---|---|---|---|
|
March 17, 2017 multi compare | ||||
---|---|---|---|---|
| ||||
Instead of if (x == a || x == b || x = c || ....) is there an easier way stuff like if (x in [a,b,c,..]) doesn't work. |
March 17, 2017 Re: multi compare | ||||
---|---|---|---|---|
| ||||
Posted in reply to Hussien | On Friday, 17 March 2017 at 00:39:15 UTC, Hussien wrote: > if (x in [a,b,c,..]) import std.algorithm.comparison; x.among(a, b, c); http://dpldocs.info/experimental-docs/std.algorithm.comparison.among.1.html |
March 17, 2017 Re: multi compare | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Friday, 17 March 2017 at 01:27:01 UTC, Adam D. Ruppe wrote:
> On Friday, 17 March 2017 at 00:39:15 UTC, Hussien wrote:
>> if (x in [a,b,c,..])
>
> import std.algorithm.comparison;
>
> x.among(a, b, c);
>
> http://dpldocs.info/experimental-docs/std.algorithm.comparison.among.1.html
thanks
|
Copyright © 1999-2021 by the D Language Foundation