fixes #6125
This commit is contained in:
parent
4e3bdcc84b
commit
44bd4d8774
2 changed files with 5 additions and 10 deletions
|
|
@ -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:
|
literals* to create block comments:
|
||||||
|
|
||||||
.. code-block:: nim
|
.. code-block:: nim
|
||||||
|
|
@ -364,8 +364,7 @@ iterator:
|
||||||
echo i
|
echo i
|
||||||
# --> Outputs 1 2 3 4 5 6 7 8 9 10 on different lines
|
# --> 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
|
The variable ``i`` is implicitly declared by the
|
||||||
other types into a string. The variable ``i`` is implicitly declared by the
|
|
||||||
``for`` loop and has the type ``int``, because that is what `countup
|
``for`` loop and has the type ``int``, because that is what `countup
|
||||||
<system.html#countup>`_ returns. ``i`` runs through the values 1, 2, .., 10.
|
<system.html#countup>`_ returns. ``i`` runs through the values 1, 2, .., 10.
|
||||||
Each value is ``echo``-ed. This code does the same:
|
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 ``when`` statement is useful for writing platform specific code, similar to
|
||||||
the ``#ifdef`` construct in the C programming language.
|
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
|
Statements and indentation
|
||||||
==========================
|
==========================
|
||||||
|
|
|
||||||
|
|
@ -233,15 +233,15 @@ is needed:
|
||||||
|
|
||||||
type
|
type
|
||||||
Socket* = ref object of RootObj
|
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.} =
|
proc `host=`*(s: var Socket, value: int) {.inline.} =
|
||||||
## setter of host address
|
## setter of host address
|
||||||
s.host = value
|
s.h = value
|
||||||
|
|
||||||
proc host*(s: Socket): int {.inline.} =
|
proc host*(s: Socket): int {.inline.} =
|
||||||
## getter of host address
|
## getter of host address
|
||||||
s.host
|
s.h
|
||||||
|
|
||||||
var s: Socket
|
var s: Socket
|
||||||
new s
|
new s
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue