Changes

Jump to navigation Jump to search
554 bytes added ,  18:14, 24 August 2016
add section for error messages
Line 65: Line 65:  
             44.04 55.05  6.06];
 
             44.04 55.05  6.06];
 
</pre>
 
</pre>
 +
 +
== Error messages ==
 +
 +
When you encounter an error condition, call the function {{codeline|error}}
 +
(or {{codeline|print_usage}}).  The {{codeline|error}} and {{codeline|print_usage}} functions
 +
do not return.  It is customary to prefix the error message
 +
with the name of the function that generated it.  For example:
 +
 +
<pre>error ("my_cool_function: input A must be a matrix");</pre>
 +
 +
Octave has several functions that produce error messages according
 +
to the Octave guidelines.  Consider using {{codeline|inputParser}}
 +
and {{codeline|validateattributes}}.
    
== Naming ==
 
== Naming ==

Navigation menu