tut1.txt no BOM; streamlined example a bit
This commit is contained in:
parent
d02cc41596
commit
887a1ebe68
1 changed files with 4 additions and 8 deletions
12
doc/tut1.txt
12
doc/tut1.txt
|
|
@ -1,4 +1,4 @@
|
||||||
========================
|
========================
|
||||||
Nimrod Tutorial (Part I)
|
Nimrod Tutorial (Part I)
|
||||||
========================
|
========================
|
||||||
|
|
||||||
|
|
@ -1521,17 +1521,13 @@ techniques.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
.. code-block:: nimrod
|
.. code-block:: nimrod
|
||||||
|
proc echoItem(x: int) = echo(x)
|
||||||
|
|
||||||
type
|
proc forEach(action: proc (x: int)) =
|
||||||
TCallback = proc (x: int)
|
|
||||||
|
|
||||||
proc echoItem(x: Int) = echo(x)
|
|
||||||
|
|
||||||
proc forEach(callback: TCallback) =
|
|
||||||
const
|
const
|
||||||
data = [2, 3, 5, 7, 11]
|
data = [2, 3, 5, 7, 11]
|
||||||
for d in items(data):
|
for d in items(data):
|
||||||
callback(d)
|
action(d)
|
||||||
|
|
||||||
forEach(echoItem)
|
forEach(echoItem)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue