From 44bd4d87743db6a9b2059d16307315e037d02522 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sat, 22 Jul 2017 17:20:33 +0200 Subject: [PATCH] fixes #6125 --- doc/tut1.rst | 9 ++------- doc/tut2.rst | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/doc/tut1.rst b/doc/tut1.rst index fc8e411cbf..89893a39a9 100644 --- a/doc/tut1.rst +++ b/doc/tut1.rst @@ -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 `$ `_ 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 `_ 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 ========================== diff --git a/doc/tut2.rst b/doc/tut2.rst index f145528a13..763dd9b01f 100644 --- a/doc/tut2.rst +++ b/doc/tut2.rst @@ -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