summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhlaaftana <10591326+hlaaftana@users.noreply.github.com>2020-03-01 23:52:29 +0300
committerGitHub <noreply@github.com>2020-03-01 21:52:29 +0100
commit525ab5a497d1b998bc67c5b1225db3556ac77d27 (patch)
treeffa5ea764cc443760d8abd49a3ca3d48a60224db
parent0f1a4ac96cf41222c41e91c649407fa8c37a527e (diff)
downloadNim-525ab5a497d1b998bc67c5b1225db3556ac77d27.tar.gz
Document import/include outside of top level semantics (#13548)
-rw-r--r--doc/manual.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/manual.rst b/doc/manual.rst
index ba13f2f02..71f6f73f9 100644
--- a/doc/manual.rst
+++ b/doc/manual.rst
@@ -5645,6 +5645,8 @@ It is not checked that the ``except`` list is really exported from the module.
 This feature allows to compile against an older version of the module that
 does not export these identifiers.
 
+The ``import`` statement is only allowed at the top level.
+
 
 Include statement
 ~~~~~~~~~~~~~~~~~
@@ -5655,6 +5657,18 @@ statement is useful to split up a large module into several files:
 .. code-block:: nim
   include fileA, fileB, fileC
 
+The ``include`` statement can be used outside of the top level, as such:
+
+.. code-block:: nim
+  # Module A
+  echo "Hello World!"
+
+.. code-block:: nim
+  # Module B
+  proc main() =
+    include A
+  
+  main() # => Hello World!
 
 
 Module names in imports