Mercurial > hg > octave-lyh
changeset 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 | 4727fd4dd4bb |
children | 8c52ab9842c9 |
files | doc/ChangeLog doc/interpreter/func.txi |
diffstat | 2 files changed, 25 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2011-04-11 Rik <octave@nomad.inbox5.com> + + * interpreter/func.txi: Add discussion of isargout to Ignoring + Arguments section of documentation. + 2011-04-07 Rik <octave@nomad.inbox5.com> * interpreter/Makefile.am: Add spellcheck target to documentation
--- 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