Difference between revisions of "Error Messages/40206"

(Created page with "= Warning Message = :The expression evaluation is attempting to use the "else" result from an IF-THEN construct that does not have an ELSE clause. = Cause = Co...")
 
 
Line 1: Line 1:
= Warning Message =
+
[[Category: Error messages]]
  
:The expression evaluation is attempting to use the "else" result from an [[If|IF-THEN]] construct that does not have an [[Else|ELSE]] clause.
+
== Warning message ==
  
= Cause =
+
:<code>''The expression evaluation is attempting to use the "else" result from an IF-THEN construct''</code>
 +
:<code>''that does not have an ELSE clause.''</code>
 +
 
 +
== Cause ==
  
 
Consider this definition of a variable
 
Consider this definition of a variable
  
:<code>[[If]] Population<100K [[Then]] 'Small'</code>
+
:<code>If Population < 100K Then 'Small'</code>
  
 
When this is evaluated and there is a municipality with 100K or more people, there is no value provided by the expression, and thus, this warning results.  If the warning is ignored, the value will be [[Null]]. In a case like this, you should stop the evaluation and add an [[Else]] clause, even if you want the result to be [[Null]], e.g.
 
When this is evaluated and there is a municipality with 100K or more people, there is no value provided by the expression, and thus, this warning results.  If the warning is ignored, the value will be [[Null]]. In a case like this, you should stop the evaluation and add an [[Else]] clause, even if you want the result to be [[Null]], e.g.
  
:<code>[[If]] Population<100K [[Then]] 'Small' [[Else]] [[Null]]</code>
+
:<code>If Population < 100K Then 'Small' Else Null</code>
  
 
The appropriate time to omit the [[Else]] clause is when the result value is going to be ignored no matter what.  For example,
 
The appropriate time to omit the [[Else]] clause is when the result value is going to be ignored no matter what.  For example,
  
:<code>[[If]] Area=0 [[Then]] [[MsgBox]]("x=0 was encountered");<br />Population/Area</code>
+
:<code>If Area = 0 Then MsgBox("x = 0 was encountered");</code>
 
+
:<code>Population/Area</code>
= See Also =
 
  
 +
== See Also ==
 +
* [[IF a THEN b ELSE c]]
 
* [[If-Then-Else]]
 
* [[If-Then-Else]]

Latest revision as of 23:00, 15 March 2016


Warning message

The expression evaluation is attempting to use the "else" result from an IF-THEN construct
that does not have an ELSE clause.

Cause

Consider this definition of a variable

If Population < 100K Then 'Small'

When this is evaluated and there is a municipality with 100K or more people, there is no value provided by the expression, and thus, this warning results. If the warning is ignored, the value will be Null. In a case like this, you should stop the evaluation and add an Else clause, even if you want the result to be Null, e.g.

If Population < 100K Then 'Small' Else Null

The appropriate time to omit the Else clause is when the result value is going to be ignored no matter what. For example,

If Area = 0 Then MsgBox("x = 0 was encountered");
Population/Area

See Also

Comments


You are not allowed to post comments.