The proper parlance for the main()
entry point in D is
void main(char[][] args)
{
}
but how would I know if there aren't any arguments passed, given it's an array?
void main(char[][] args)
In modern D, the canonical signature is void main(string[] args)
, or void main()
if your program doesn't need arguments.
but how would I know if there aren't any arguments passed, given it's an array?
Check the array's .length
property. If args.length==1
, then no arguments have been passed to the program. (Argument 0 is always the program itself, as in C/C++.)