mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-06 11:54:11 +00:00
fixes #6125
This commit is contained in:
@@ -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
|
||||
==========================
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user