Apply a callback to an array: Difference between revisions

Content added Content deleted
(→‎{{header|Go}}: replace with Ruby translation)
(Updated D entry)
Line 401: Line 401:


void main() {
void main() {
auto array = [1, 2, 3, 4, 5];
auto items = [1, 2, 3, 4, 5];
auto m = map!(x => x + 5)(array);
auto m = items.map!(x => x + 5)();
writeln(m);
writeln(m);
}</lang>
}</lang>
{{out}}
Output:
<pre>[6, 7, 8, 9, 10]</pre>
<pre>[6, 7, 8, 9, 10]</pre>