mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
Adds note about procs and multiple variable assignment.
This commit is contained in:
@@ -202,6 +202,12 @@ statement and all the variables will have the same value:
|
||||
echo "x ", x # outputs "x 42"
|
||||
echo "y ", y # outputs "y 3"
|
||||
|
||||
Note that declaring multiple variables with a single assignment which calls a
|
||||
procedure can have unexpected results: the compiler will *unroll* the
|
||||
assignments and end up calling the procedure several times. If the result of
|
||||
the procedure depends on side effects, your variables may end up having
|
||||
different values! For safety use only constant values.
|
||||
|
||||
|
||||
Constants
|
||||
=========
|
||||
|
||||
Reference in New Issue
Block a user