diff options
author | Araq <rumpf_a@web.de> | 2013-01-23 13:21:01 -0800 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-01-23 13:21:01 -0800 |
commit | c1536c12f5fb1f8435bf4b5dd662c2d82e7f7866 (patch) | |
tree | 42d8a2ddbf8a7c6724b282dc2d933eeca5fb7818 /doc/manual.txt | |
parent | 899193268aef7638c3cd14fb286ee59e1fae6e17 (diff) | |
parent | acc394ca239b1a1ae864017c22aae8660b655053 (diff) | |
download | Nim-c1536c12f5fb1f8435bf4b5dd662c2d82e7f7866.tar.gz |
Merge pull request #312 from gradha/pr_adds_some_docs_about_exceptions
Adds some documentation related to exceptions.
Diffstat (limited to 'doc/manual.txt')
-rwxr-xr-x | doc/manual.txt | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/doc/manual.txt b/doc/manual.txt index 2a79c0f99..80a5642c5 100755 --- a/doc/manual.txt +++ b/doc/manual.txt @@ -2843,6 +2843,23 @@ in an implicit try block: finally: close(f) ... +The ``except`` statement has a limitation in this form: you can't specify the +type of the exception, you have to catch everything. Also, if you want to use +both ``finally`` and ``except`` you need to reverse the usual sequence of the +statements. Example: + +.. code-block:: nimrod + proc test() = + raise newException(E_base, "Hey ho") + + proc tester() = + finally: echo "3. Finally block" + except: echo "2. Except block" + echo "1. Pre exception" + test() + echo "4. Post exception" + # --> 1, 2, 3 is printed, 4 is never reached + Raise statement --------------- |