| 1 |
<html><head><meta name="robots" content="index,follow"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 2 |
<title>assert</title> |
| 3 |
<style> |
| 4 |
td { padding-left: 5pt; padding-right: 5pt; } |
| 5 |
th { padding-left: 5pt; padding-right: 5pt; } |
| 6 |
code { white-space: pre-wrap; } |
| 7 |
dd { white-space: pre-wrap; } |
| 8 |
</style> |
| 9 |
</head><body bgcolor="#FFFFFF"> |
| 10 |
|
| 11 |
<table border=0 cellpadding=0 cellspacing=0><tr><td bgcolor="#CCCC00"><table border=4 cellpadding=9><tr><td align=middle bgcolor="#000000"><font face="Monaco,Courier" size=6 color="#999900"><b> |
| 12 |
assert |
| 13 |
</b></font></table></table> |
| 14 |
<p>A keyword that can be used in <a href="Scripting.html">Scripting</a>, to test whether an expected condition holds.</p> |
| 15 |
<h2>Examples</h2> |
| 16 |
<p>This is an assertion that is satisfied:</p> |
| 17 |
<code> a = 5*6<br></code> |
| 18 |
<code> <b>assert</b> a = 30<br></code> |
| 19 |
<code> writeInfoLine: a<br></code> |
| 20 |
<code style="color:red">=></code><br> |
| 21 |
<code> 30<br></code> |
| 22 |
<p>This is an assertion that is violated:</p> |
| 23 |
<code> a = 5*6<br></code> |
| 24 |
<code> <b>assert</b> a < 10<br></code> |
| 25 |
<code> writeInfoLine: a<br></code> |
| 26 |
<p>This three-line script stops at the second line with the error message “<code><font size=+1>Assertion violated in line 2: a < 10</font></code>”.</p> |
| 27 |
<p>That is, because <i><code><font size=+1>a</font></code></i> is not less than 10 (it’s 30), the assertion is false, and the script stops, mentioning the line number as well as the text of the assertion (i.e. “<code><font size=+1>a < 10</font></code>”).</p> |
| 28 |
<h3>Links to this page</h3> |
| 29 |
<ul> |
| 30 |
<li><a href="_arccos_.html"><code><font size=+1>arccos</font></code></a> |
| 31 |
<li><a href="_arccosh_.html"><code><font size=+1>arccosh</font></code></a> |
| 32 |
<li><a href="_arcsin_.html"><code><font size=+1>arcsin</font></code></a> |
| 33 |
<li><a href="_arcsinh_.html"><code><font size=+1>arcsinh</font></code></a> |
| 34 |
<li><a href="_arctan2_.html"><code><font size=+1>arctan2</font></code></a> |
| 35 |
<li><a href="_arctan_.html"><code><font size=+1>arctan</font></code></a> |
| 36 |
<li><a href="_arctanh_.html"><code><font size=+1>arctanh</font></code></a> |
| 37 |
<li><a href="_col-H_.html"><code><font size=+1>col#</font></code></a> |
| 38 |
<li><a href="_combine-H_.html"><code><font size=+1>combine#</font></code></a> |
| 39 |
<li><a href="_lowerCase-S_.html"><code><font size=+1>lowerCase$</font></code></a> |
| 40 |
<li><a href="_max_.html"><code><font size=+1>max</font></code></a> |
| 41 |
<li><a href="_number_.html"><code><font size=+1>number</font></code></a> |
| 42 |
<li><a href="_padLeft-S_.html"><code><font size=+1>padLeft$</font></code></a> |
| 43 |
<li><a href="_padOrTruncateLeft-S_.html"><code><font size=+1>padOrTruncateLeft$</font></code></a> |
| 44 |
<li><a href="_padOrTruncateRight-S_.html"><code><font size=+1>padOrTruncateRight$</font></code></a> |
| 45 |
<li><a href="_padRight-S_.html"><code><font size=+1>padRight$</font></code></a> |
| 46 |
<li><a href="_part-H-H_.html"><code><font size=+1>part##</font></code></a> |
| 47 |
<li><a href="_part-H_.html"><code><font size=+1>part#</font></code></a> |
| 48 |
<li><a href="_row-H_.html"><code><font size=+1>row#</font></code></a> |
| 49 |
<li><a href="_selected-H_.html"><code><font size=+1>selected#</font></code></a> |
| 50 |
<li><a href="_selected-S-H_.html"><code><font size=+1>selected$#</font></code></a> |
| 51 |
<li><a href="_truncateLeft-S_.html"><code><font size=+1>truncateLeft$</font></code></a> |
| 52 |
<li><a href="_truncateRight-S_.html"><code><font size=+1>truncateRight$</font></code></a> |
| 53 |
<li><a href="_upperCase-S_.html"><code><font size=+1>upperCase$</font></code></a> |
| 54 |
<li><a href="energy_integration_continuity_test.html">energy integration continuity test</a> |
| 55 |
<li><a href="Functions.html">Functions</a> |
| 56 |
</ul> |
| 57 |
<hr> |
| 58 |
<address> |
| 59 |
<p>© Paul Boersma 2023</p> |
| 60 |
</address> |
| 61 |
</body> |
| 62 |
</html> |