Mercurial > hg > octave-lyh
changeset 16770:2b86cb4e172b
doc: clarify docstring regarding null input to error() (bug #39271).
* libinterp/interpfcn/error.cc(error): clarify docstring regarding null input
to error() (bug #39271).
author | Rik <rik@octave.org> |
---|---|
date | Tue, 18 Jun 2013 11:10:57 -0700 |
parents | 1c68c76c80c8 |
children | d8a719ccd464 |
files | libinterp/interpfcn/error.cc |
diffstat | 1 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interpfcn/error.cc +++ b/libinterp/interpfcn/error.cc @@ -1069,6 +1069,27 @@ @end group\n\ @end example\n\ \n\ +A null string (\"\") input to @code{error} will be ignored and the code\n\ +will continue running as if the statement were a NOP@. This is for\n\ +compatibility with @sc{matlab}. It also makes it possible to write code such\n\ +as\n\ +\n\ +@example\n\ +@group\n\ +err_msg = \"\";\n\ +if (CONDITION 1)\n\ + err_msg = \"CONDITION 1 found\";\n\ +elseif (CONDITION2)\n\ + err_msg = \"CONDITION 2 found\";\n\ +@dots{}\n\ +endif\n\ +error (err_msg);\n\ +@end group\n\ +@end example\n\ +\n\ +@noindent\n\ +which will only stop execution if an error has been found.\n\ +\n\ Implementation Note: For compatibility with @sc{matlab}, escape\n\ sequences (e.g., \"\\n\" => newline) are processed in @var{template}\n\ regardless of whether @var{template} has been defined within single quotes\n\