There are 2 ways you can solve your problem

```d
string returnExecutableName(string[] arguments) {
        // if you compile with `-debug` it'll run this block
        debug {
                write("Debug mode is enabled.\n");
                write(" Executable_Name: " ~ arguments[0] ~ "\n");
        }
        return arguments[0];
}
```

```d
string returnExecutableName(string[] arguments) {
        // if you compile with `-version=VERBOSE` it'll run this block
        version (VERBOSE) {
                write("Debug mode is enabled.\n");
                write(" Executable_Name: " ~ arguments[0] ~ "\n");
        }
        return arguments[0];
}
```

You don't even need that function at this point

```d
import std.stdio;

void main(string[] args) {
        debug {
                write("Debug mode is enabled.\n");
                write(" Executable_Name: " ~ args[0] ~ "\n");
        }
}
```

There, it's cleaner without indirections

Reply via email to