Difference between revisions of "Error Messages/40020"

(Created page with '= Error Message Examples = The condition for "while" evaluates to an array. It should evaluate to true(non-zero) of false(zero). = Cause = This error is caused when an array …')
 
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
= Error Message Examples =
+
[[Category:Error messages]]
  
The condition for "while" evaluates to an array. It should evaluate to true(non-zero) of false(zero).
+
== Error message examples ==
  
= Cause =
+
:<code>''The condition for "while" evaluates to an array. It should evaluate to true (non-zero) of false (zero).''</code>
  
This error is caused when an array is passed as the condition of a while loop. The following code will produce this error as Time is an array and "Time > 5" will evaluate to an array.
+
== Cause ==
 +
This error is caused when an array is passed as the condition of a [[while]] loop. The following code will produce this error as [[Time]] is an array and <code>Time > 5</code> will evaluate to an array.
  
<code>
+
:<code>Var a:= 5; </code>
Var a:= 5; <br>
+
:<code>While(Time > 5) Do{</code>
While( Time > 5 ) Do{<br>
+
:<code>a++;</code>
a++;<br>
+
:<code>}</code>
}<br>
+
:<code>...</code>
a;
 
</code>
 
  
= Remedies =
+
== Remedies ==
 +
Correct the condition for the while loop so it evaluates to true or false.
  
Correct the condition for the while loop so it evaluates to true or false.
+
=== Suggested revised message ===
 +
In a construct '''WHILE''' <cond> '''DO''' <exp>, the condition should be a scalar (true (non-zero) or false (zero)), but not an [[array]].  See [[Ensuring Array Abstraction]] in [[Analytica User Guide]] on how to deal with this.
  
<br>
+
==See Also==
<comments />
+
* [[While..Do]]
 +
* [[Time]]
 +
* [[Array Abstraction]]
 +
* [[Ensuring Array Abstraction]]

Latest revision as of 01:26, 4 February 2016


Error message examples

The condition for "while" evaluates to an array. It should evaluate to true (non-zero) of false (zero).

Cause

This error is caused when an array is passed as the condition of a while loop. The following code will produce this error as Time is an array and Time > 5 will evaluate to an array.

Var a:= 5;
While(Time > 5) Do{
a++;
}
...

Remedies

Correct the condition for the while loop so it evaluates to true or false.

Suggested revised message

In a construct WHILE <cond> DO <exp>, the condition should be a scalar (true (non-zero) or false (zero)), but not an array. See Ensuring Array Abstraction in Analytica User Guide on how to deal with this.

See Also

Comments


You are not allowed to post comments.