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
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.
On Thursday, 5 February 2015 at 13:31:21 UTC, Nicholas Wilson
wrote:
Note that D does NOT have default fall through. i.e.
switch(myopt)
{
case "opt1", "opt2", "opt3":
do_A();
break;
case "opt4":
do_B();
break;
default:
do_C();
}
is equivalent
On Thursday, 5 February 2015 at 13:31:21 UTC, Nicholas Wilson
wrote:
On Thursday, 5 February 2015 at 12:31:31 UTC, Stéphane wrote:
Syntax for checking if an element exists in a list
Hello,
I would like to know if there is a better (easier to wite,
easier to read, easier to understand) way
On Thursday, 5 February 2015 at 12:31:31 UTC, Stéphane wrote:
Syntax for checking if an element exists in a list
Hello,
I would like to know if there is a better (easier to wite,
easier to read, easier to understand) way to check if an element
(string) is
in a list of strings.
Here are
import std.algorithm;
int main(string[] options)
{
// true if the first option given to this program is
either foo, bar, or baz.
if(options[1].canFind("foo", "bar", "baz"))
return 0;
return 1;
}
Syntax for checking if an element exists in a list
Hello,
I would like to know if there is a better (easier to wite,
easier to read, easier to understand) way to check if an element
(string) is
in a list of strings.
Here are the possibilities I see today, as someone who is new
to D:
1