Here is byref: import std.typecons; import std.stdio; void myfunction(double x, ref double[] a, ref double[] b) { a~=x+1.0; a~=x+9.0; b~=x+2.0; b~=x+11.0; return; } void main() { double[] a; double[] b; myfunction(99.0,a,b); writefln("%s %s",a,b); }