Apply a callback to an array: Difference between revisions

→‎Nim: Add necessary `import` for `apply`
(Jakt)
(→‎Nim: Add necessary `import` for `apply`)
Line 2,235:
=={{header|Nim}}==
 
<syntaxhighlight lang="nim">var arr = @[1,2,3,4]
from std/sequtils import apply
var arr = @[1,2,3,4]
arr.apply proc(some: var int) = echo(some, " squared = ", some*some)</syntaxhighlight>
 
2

edits