summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
authorGrzegorz Adam Hankiewicz <gradha@imap.cc>2013-12-30 03:06:22 -0800
committerGrzegorz Adam Hankiewicz <gradha@imap.cc>2013-12-30 03:06:22 -0800
commit987ac2439a87d74838233a7b188e4db340495ee5 (patch)
tree5cbc701a9491f3040c017ca78bcc0ebeadfb92c0 /lib/system.nim
parentf622504b5b093b51f9bb4db77f81f96d096a3f54 (diff)
parentf33f15afe804887be3ac24f48969fb724497730b (diff)
downloadNim-987ac2439a87d74838233a7b188e4db340495ee5.tar.gz
Merge pull request #776 from gradha/pr_docs
Docstrings
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 106eb04a3..26109bb97 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2675,5 +2675,21 @@ proc locals*(): TObject {.magic: "Locals", noSideEffect.} =
   ## in the current scope. This is quite fast as it does not rely
   ## on any debug or runtime information. Note that in constrast to what
   ## the official signature says, the return type is not ``TObject`` but a
-  ## tuple of a structure that depends on the current scope.
+  ## tuple of a structure that depends on the current scope. Example:
+  ##
+  ## .. code-block:: nimrod
+  ##   proc testLocals() =
+  ##     var
+  ##       a = "something"
+  ##       b = 4
+  ##       c = locals()
+  ##       d = "super!"
+  ##
+  ##     b = 1
+  ##     for name, value in fieldPairs(c):
+  ##       echo "name ", name, " with value ", value
+  ##     echo "B is ", b
+  ##   # -> name a with value something
+  ##   # -> name b with value 4
+  ##   # -> B is 1
   nil