This commit is contained in:
Andreas Rumpf
2017-07-22 17:20:33 +02:00
parent 4e3bdcc84b
commit 44bd4d8774
2 changed files with 5 additions and 10 deletions

View File

@@ -138,7 +138,7 @@ comments can also be nested.
]#
]#
You can also use the `discard statement`_ together with *long string
You can also use the `discard statement <#procedures-discard-statement>`_ together with *long string
literals* to create block comments:
.. code-block:: nim
@@ -364,8 +364,7 @@ iterator:
echo i
# --> Outputs 1 2 3 4 5 6 7 8 9 10 on different lines
The built-in `$ <system.html#$>`_ operator turns an integer (``int``) and many
other types into a string. The variable ``i`` is implicitly declared by the
The variable ``i`` is implicitly declared by the
``for`` loop and has the type ``int``, because that is what `countup
<system.html#countup>`_ returns. ``i`` runs through the values 1, 2, .., 10.
Each value is ``echo``-ed. This code does the same:
@@ -501,10 +500,6 @@ differences:
The ``when`` statement is useful for writing platform specific code, similar to
the ``#ifdef`` construct in the C programming language.
**Note**: To comment out a large piece of code, it is often better to use a
``when false:`` statement than to use real comments. This way nesting is
possible.
Statements and indentation
==========================

View File

@@ -233,15 +233,15 @@ is needed:
type
Socket* = ref object of RootObj
host: int # cannot be accessed from the outside of the module due to missing star
h: int # cannot be accessed from the outside of the module due to missing star
proc `host=`*(s: var Socket, value: int) {.inline.} =
## setter of host address
s.host = value
s.h = value
proc host*(s: Socket): int {.inline.} =
## getter of host address
s.host
s.h
var s: Socket
new s