diff --git a/refdoc/chapters/control_structures.xml b/refdoc/chapters/control_structures.xml index 17008183f08562cd09616972310e14e3e7c4ccb7..4af6274307ba0bcb88b3a92032920dd901eb6ed3 100644 --- a/refdoc/chapters/control_structures.xml +++ b/refdoc/chapters/control_structures.xml @@ -292,9 +292,9 @@ that is still missing is the ability to exit a loop in the middle of it. There are three ways to do this:</p> <subsection title="break"> -<p><tt>break</tt> exits a loop or switch statement immediately and continues -executing after the loop. <tt>Break</tt> can not be used outside of a loop or -switch. It is quite useful in conjunction with <tt>while(1)</tt> to +<p><tt>break</tt> exits a loop, switch, or catch statement immediately and continues +executing after the loop. <tt>Break</tt> can not be used outside of one of these. +It is quite useful in conjunction with <tt>while(1)</tt> to construct command parsing loops for instance:</p> <example> @@ -326,6 +326,11 @@ a:if(sizeof(arr1) >= sizeof(arr2)) // execution continues here } </example> + +<p>Inside a <tt>catch</tt> block, <tt>break</tt> will terminate the block with no +exception being thrown; <tt>catch</tt> will return zero, as if execution had +continued to the end of the block.</p> + </subsection> <subsection title="continue"> diff --git a/refdoc/chapters/special_functions.xml b/refdoc/chapters/special_functions.xml index c1084a400927b11e92bb423855ed554b0e86a7e0..869c5d66682000cc844dba7ab9ccf0a52fcfe3aa 100644 --- a/refdoc/chapters/special_functions.xml +++ b/refdoc/chapters/special_functions.xml @@ -35,7 +35,8 @@ The description of the error has the following format:</p> }) </example> -<p>If no error occurs, catch will return zero. You may emulate your own errors +<p>If no error occurs, or if the <ref>break</ref> statement is +encountered, catch will return zero. You may emulate your own errors using the function throw or error.</p> <example>