Setting default values for Main function's args Array

Vaidas vaidas.boqsc at gmail.com
Thu Jun 27 17:05:05 UTC 2019


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[1]);
>}

Output:
>vaidas at vaidas-SATELLITE-L855:~/Desktop$ rdmd newfile.d
>>core.exception.RangeError at newfile.d(4): Range violation
>----------------
>??:? _d_arrayboundsp [0x555f5b79f8e9]
>??:? _Dmain [0x555f5b79e7ee]



More information about the Digitalmars-d-learn mailing list