Re: Syntax for checking if an element exists in a list

2015-02-05 Thread Stéphane
On Thursday, 5 February 2015 at 13:31:21 UTC, Nicholas Wilson wrote: Note that D does NOT have default fall through. i.e. Yes, but I thought I read that we always had to explicitely specify one ending statement, as "goto", "continue"... or "break"; which, in many basic cases, means having t

Re: Syntax for checking if an element exists in a list

2015-02-05 Thread Stéphane
On Thursday, 5 February 2015 at 12:35:03 UTC, Tobias Pankrath wrote: import std.algorithm; if(options[1].canFind("foo", "bar", "baz")) This looks quite OK. Thank you, I did not know about that possibility.

Syntax for checking if an element exists in a list

2015-02-05 Thread Stéphane
tialisation, like (the delimiters and sigil are random, not a real suggestion): if(myopt in /"opt1", "opt2", "opt3"/) { ... } if(myopt in $["opt1", "opt2", "opt3"]) { ... } But perhaps one of these solutions, or some other, already wo