summary refs log tree commit diff stats
path: root/doc
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-06-22 17:47:03 +0200
committerAraq <rumpf_a@web.de>2012-06-22 17:47:03 +0200
commit48847b561688e1e8b0518141455bb8e957290a56 (patch)
tree4c51e3dbb080d2c48a80353504ea527263343e77 /doc
parent09499b3822b30bd1b88addcb78344d458586001f (diff)
downloadNim-48847b561688e1e8b0518141455bb8e957290a56.tar.gz
documented optional indentation for 'case' statements/'case' objects
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/manual.txt16
1 files changed, 14 insertions, 2 deletions
diff --git a/doc/manual.txt b/doc/manual.txt
index bf50c9679..1641f5338 100755
--- a/doc/manual.txt
+++ b/doc/manual.txt
@@ -932,7 +932,10 @@ An example:
 As can been seen from the example, an advantage to an object hierarchy is that

 no casting between different object types is needed. Yet, access to invalid

 object fields raises an exception.

-

+
+The syntax of ``case`` in an object declaration follows closely the syntax of
+the ``case`` statement: The branches in a ``case`` section may be indented too.

+
 

 Set type

 ~~~~~~~~

@@ -1732,7 +1735,16 @@ Example:
   of "delete-everything", "restart-computer":

     echo("permission denied")

   of "go-for-a-walk":     echo("please yourself")

-  else:                   echo("unknown command")

+  else:                   echo("unknown command")
+  
+  # indentation of the branches is also allowed; and so is an optional colon
+  # after the selecting expression:
+  case readline(stdin):

+    of "delete-everything", "restart-computer":

+      echo("permission denied")

+    of "go-for-a-walk":     echo("please yourself")

+    else:                   echo("unknown command")
+  

 

 The `case`:idx: statement is similar to the if statement, but it represents

 a multi-branch selection. The expression after the keyword ``case`` is