The init
property of an array returns an array literal, with each element of the literal being the .init
property of the array element.
array.init
It returns an array literal, with each element of the literal initialized.
// import std.stdioimport std.stdio;// main methodvoid main(string[] args) {// create an arraystring[3] names;// add valuesnames[0] = "Theodore";names[1] = "John";names[2] = "Jane";// print the length of the arraywriteln(names.init);}
std
library.init
of the array elements to the console.