[backport] Mention "lambdas" and => in the manual (#12397) [ci skip]
(so that "lambda" can be CTRL+F'd)
This commit is contained in:
parent
f728614ef8
commit
3b1760df72
1 changed files with 5 additions and 3 deletions
|
|
@ -3511,8 +3511,8 @@ for details on how to change this behavior.
|
||||||
Anonymous Procs
|
Anonymous Procs
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
Procs can also be treated as expressions, in which case it's allowed to omit
|
Unnamed procedures can be used as lambda expressions to pass into other
|
||||||
the proc's name.
|
procedures:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
var cities = @["Frankfurt", "Tokyo", "New York", "Kyiv"]
|
var cities = @["Frankfurt", "Tokyo", "New York", "Kyiv"]
|
||||||
|
|
@ -3522,7 +3522,9 @@ the proc's name.
|
||||||
|
|
||||||
|
|
||||||
Procs as expressions can appear both as nested procs and inside top level
|
Procs as expressions can appear both as nested procs and inside top level
|
||||||
executable code.
|
executable code. The `sugar <sugar.html>`_ module contains the `=>` macro
|
||||||
|
which enables a more succinct syntax for anonymous procedures resembling
|
||||||
|
lambdas as they are in languages like JavaScript, C#, etc.
|
||||||
|
|
||||||
|
|
||||||
Func
|
Func
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue