summary refs log tree commit diff stats
path: root/doc/tut1.rst
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2020-10-27 07:27:02 +0100
committerGitHub <noreply@github.com>2020-10-27 07:27:02 +0100
commit25955440df3bf32b058ed27bdc2e619874f0d4ee (patch)
tree76cbc7a7690525e06ada922a44b447be5505046c /doc/tut1.rst
parent3bdc0005211b0d543e0ff48ccf6bc5a9f2a2a30b (diff)
downloadNim-25955440df3bf32b058ed27bdc2e619874f0d4ee.tar.gz
Document implicit return values from procedures (#15738)
Diffstat (limited to 'doc/tut1.rst')
-rw-r--r--doc/tut1.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/tut1.rst b/doc/tut1.rst
index 24874096c..68e74df52 100644
--- a/doc/tut1.rst
+++ b/doc/tut1.rst
@@ -641,6 +641,16 @@ 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.
 
+A procedure that does not have any ``return`` statement and does not use the
+special ``result`` variable returns the value of its last expression. For example,
+this procedure
+
+.. code-block:: nim
+    :test: "nim c $1"
+  proc helloWorld(): string =
+      "Hello, World!"
+
+returns the string "Hello, World!".
 
 Parameters
 ----------