Mercurial > hg > octave-lyh
diff doc/interpreter/func.txi @ 12594:a3a7da1489b2 stable
Modify func.txi discussion of output arguments to include discussion of isargout.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Mon, 11 Apr 2011 19:03:32 -0700 |
parents | 6f8ffe2c6f76 |
children | 8c25df502846 |
line wrap: on
line diff
--- a/doc/interpreter/func.txi +++ b/doc/interpreter/func.txi @@ -342,8 +342,6 @@ @DOCSTRING(nargoutchk) -@DOCSTRING(isargout) - @anchor{doc-varargin} @anchor{doc-varargout} @node Variable-length Argument Lists @section Variable-length Argument Lists @@ -456,6 +454,26 @@ The value of @code{nargin} is not affected by using this declaration. +Return arguments can also be ignored using the same syntax. Functions may +take advantage of ignored outputs to reduce the number of calculations +performed. To do so, use the @code{isargout} function to query whether the +output argument is wanted. For example: + +@example +@group +function [out1, out2] = long_function (x, y, z) + if (isargout (1)) + ## Long calculation + @dots{} + out1 = result; + endif + @dots{} +endfunction +@end group +@end example + +@DOCSTRING(isargout) + @node Variable-length Return Lists @section Variable-length Return Lists @cindex variable-length return lists