On Monday, 29 October 2018 at 22:12:24 UTC, Paul Backus wrote: > Use a lambda: > > const string[] restArgs = () { > foreach(i, arg; args) { > if (isValidArg(arg)) { > return args[i+1 .. $]; > } > others ~= arg; > } > }(); That works.