Apply a callback to an array: Difference between revisions
→Nim: Add necessary `import` for `apply`
(Jakt) |
Litlighilit (talk | contribs) (→Nim: Add necessary `import` for `apply`) |
||
Line 2,235:
=={{header|Nim}}==
<syntaxhighlight lang="nim">
from std/sequtils import apply
var arr = @[1,2,3,4]
arr.apply proc(some: var int) = echo(some, " squared = ", some*some)</syntaxhighlight>
|