Mercurial > octave
diff libinterp/corefcn/variables.cc @ 20760:15eefcabcb31
doc: Add docstring for internal function __varval__.
* variables.cc (F__varval__): Add one sentence explanation of function.
Recode to place input validation first.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 25 Nov 2015 16:20:34 -0800 |
parents | 200ae1d650b7 |
children | 58e79b0078e4 |
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc Wed Nov 25 15:45:46 2015 -0800 +++ b/libinterp/corefcn/variables.cc Wed Nov 25 16:20:34 2015 -0800 @@ -2654,20 +2654,18 @@ DEFUN (__varval__, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} __varval__ (@var{name})\n\ -Undocumented internal function.\n\ +Return the value of the variable @var{name} directly from the symbol table.\n\ @end deftypefn") { octave_value retval; - if (args.length () == 1) - { - std::string name = args(0).xstring_value ("__varval__: first argument must be a variable name"); - - retval = symbol_table::varval (args(0).string_value ()); - } - else + if (args.length () != 1) print_usage (); + std::string name = args(0).xstring_value ("__varval__: first argument must be a variable name"); + + retval = symbol_table::varval (args(0).string_value ()); + return retval; }