Referential data types may need to be declared.
And other small fixes.
This commit is contained in:
parent
e2fe9dd9ab
commit
56a6928635
1 changed files with 7 additions and 6 deletions
13
doc/tut1.txt
13
doc/tut1.txt
|
|
@ -148,12 +148,12 @@ the syntax, watch their indentation:
|
||||||
# comment has not the correct indentation level -> syntax error!
|
# comment has not the correct indentation level -> syntax error!
|
||||||
|
|
||||||
**Note**: To comment out a large piece of code, it is often better to use a
|
**Note**: To comment out a large piece of code, it is often better to use a
|
||||||
``when false:`` statement.
|
``when false:`` statement.
|
||||||
|
|
||||||
.. code-block:: nimrod
|
.. code-block:: nimrod
|
||||||
when false:
|
when false:
|
||||||
brokenCode()
|
brokenCode()
|
||||||
|
|
||||||
Another option is to use the `discard`_ statement together with
|
Another option is to use the `discard`_ statement together with
|
||||||
*long string literals* to create block comments:
|
*long string literals* to create block comments:
|
||||||
|
|
||||||
|
|
@ -161,7 +161,6 @@ Another option is to use the `discard`_ statement together with
|
||||||
discard """ You can have any nimrod code text commented
|
discard """ You can have any nimrod code text commented
|
||||||
out inside this with no indentation restrictions.
|
out inside this with no indentation restrictions.
|
||||||
yes("May I ask a pointless question?") """
|
yes("May I ask a pointless question?") """
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Numbers
|
Numbers
|
||||||
|
|
@ -606,9 +605,11 @@ the exit.
|
||||||
echo sumTillNegative(3, 4 , -1 , 6) # echos 7
|
echo sumTillNegative(3, 4 , -1 , 6) # echos 7
|
||||||
|
|
||||||
The ``result`` variable is already implicitly declared at the start of the
|
The ``result`` variable is already implicitly declared at the start of the
|
||||||
function and initialised with the type's default value, so declaring it again
|
function, so declaring it again with 'var result', for example, would shadow it
|
||||||
with 'var return', for example, would shadow it with a normal variable of the
|
with a normal variable of the same name. The result variable is also already
|
||||||
same name.
|
initialised with the type's default value. Note that referential data types will
|
||||||
|
be ``nil`` at the start of the procedure, and thus may require manual
|
||||||
|
initialisation.
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue