On Sunday, 6 April 2014 at 03:28:50 UTC, dnspies wrote:
On Sunday, 6 April 2014 at 03:23:17 UTC, Adam D. Ruppe wrote:
You can just set it to null. Then, next time you add anything to it, a new one will be automatically created.

What about if I have a 2D array (ie int[][]) and I want to append an empty int[] on the end? Will this work?

int[][] nested;

nested ~= null;

~ is overloaded, so how does it know what type I intend null to be? How can I specify it?


For dynamic arrays you can use the new operator.

nested ~= new int[];

Or in this case, you could just increment the length.

++nested.length;


Reply via email to