Programming-Idioms

History of Idiom 162 > diff from v3 to v4

Edit summary for version 4 :
[D] stringlit

Version 3

2017-08-02, 21:52:48

Version 4

2017-08-06, 15:23:52

Idiom #162 Execute procedures depending on options

execute bat if b is a program option and fox if f is a program option.

Idiom #162 Execute procedures depending on options

execute bat if b is a program option and fox if f is a program option.

Imports
import std.getopt;
Imports
import std.getopt;
Code
void main(string[] args)
{
    void bat(){} void fox(){}
    getopt(args, "b", &bat, f, &fox);
}
Code
void main(string[] args)
{
    void bat(){} void fox(){}
    getopt(args, "b", &bat, "f", &fox);
}
Comments bubble
std.getopt allows to associate functions to arguments.
Comments bubble
std.getopt allows to associate functions to arguments.
Doc URL
https://dlang.org/phobos/std_getopt.html#.getopt
Doc URL
https://dlang.org/phobos/std_getopt.html#.getopt