On Thursday, 27 June 2019 at 17:22:36 UTC, Paul Backus wrote:
On Thursday, 27 June 2019 at 17:20:37 UTC, Paul Backus wrote:
void main(string[] args)
{
string[] defaultArgs = ["my", "default", "arguments"];
if (args.length == 0) {
args = defaultArgs;
}
// Process args...
}
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote:
Is it possible to set the default values for the Main
function's arguments?
It seems that I'm getting Range error.
import std.stdio : writeln;
void main(string[] args = ["asdsfasdf", "asdklfajsdk",
"asdfasdfasd"]){
writeln("", args
On Thursday, 27 June 2019 at 17:20:37 UTC, Paul Backus wrote:
void main(string[] args)
{
string[] defaultArgs = ["my", "default", "arguments"];
if (args.length == 0) {
args = defaultArgs;
}
// Process args...
}
Correction: you should check for `args.length == 1`, since (
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote:
Is it possible to set the default values for the Main
function's arguments?
It seems that I'm getting Range error.
import std.stdio : writeln;
void main(string[] args = ["asdsfasdf", "asdklfajsdk",
"asdfasdfasd"]){
writeln("", args
On Thursday, 27 June 2019 at 17:05:05 UTC, Vaidas wrote:
Is it possible to set the default values for the Main
function's arguments?
No, as far as the language is concerned, a value is always being
passed from the operating system, so those default values would
never trigger.
What you could