update documentation for closureScope and capture (#12886)

This commit is contained in:
Judd 2019-12-21 15:06:32 +08:00 • committed by Andreas Rumpf
commit e1d79d40f2
2 changed files with 8 additions and 2 deletions

View file

@ -4395,7 +4395,12 @@ when defined(nimNoNilSeqs2):
template closureScope*(body: untyped): untyped =
## Useful when creating a closure in a loop to capture local loop variables by
## their current iteration values. Example:
## their current iteration values.
##
## Note: This template may not work in some cases, use
## `capture <sugar.html#capture.m,openArray[typed],untyped>`_ instead.
##
## Example:
##
## .. code-block:: Nim
## var myClosure : proc()