mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 07:43:26 +00:00
Document implicit return values from procedures (#15738)
This commit is contained in:
10
doc/tut1.rst
10
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
|
||||
----------
|
||||
|
||||
Reference in New Issue
Block a user