changeset 2978:49de01238638

[project @ 1997-05-15 21:13:42 by jwe]
author jwe
date Thu, 15 May 1997 21:13:43 +0000
parents d6ba658ac4ae
children a3556d2adec9
files src/ChangeLog src/pt-exp.cc src/variables.cc
diffstat 3 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
 Thu May 15 11:48:10 1997  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* variables.cc (bind_ans): Only bind ans and print result if value
+	is defined.
+
 	* defun.cc: New file.  Move functions for installing objects in
 	the symbol table here from variables.cc.
 
--- a/src/pt-exp.cc
+++ b/src/pt-exp.cc
@@ -913,7 +913,7 @@
 			      ult.assign (octave_value::asn_eq, tmp);
 			    }
 			  else
-			    error ("element number %d undefined in return list", k+1);
+			    error ("element number %d undefined in return list", k);
 
 			  if (error_state)
 			    eval_error ();
--- a/src/variables.cc
+++ b/src/variables.cc
@@ -1469,10 +1469,13 @@
 {
   static symbol_record *sr = global_sym_tab->lookup ("ans", true);
 
-  sr->define (val);
+  if (val.is_defined ())
+    {
+      sr->define (val);
 
-  if (print)
-    val.print_with_name (octave_stdout, "ans");
+      if (print)
+	val.print_with_name (octave_stdout, "ans");
+    }
 }
 
 void