1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<html>
<head>
<title>EAGLE Help: Evaluation Operators</title>
</head>
<body bgcolor=white>
<font face=Helvetica,Arial>
<hr>
<i>EAGLE Help</i>
<h1><center>Evaluation Operators</center></h1>
<hr>
Evaluation operators are used to evaluate <a href=208.htm>expressions</a>
based on a condition, or to group a sequence of expressions and have them
evaluated as one expression.
<p>
<table>
<tr><td valign=top><font face=Helvetica,Arial><tt>?:</tt> </font></td><td valign=top><font face=Helvetica,Arial>Conditional</font></td></tr>
<tr><td valign=top><font face=Helvetica,Arial><tt>,</tt> </font></td><td valign=top><font face=Helvetica,Arial>Comma</font></td></tr>
</table>
<p>
The <i>Conditional</i> operator is used to make a decision within
an expression, as in
<pre>
int a;
// ...code that calculates 'a'
string s = a ? "True" : "False";
</pre>
which is basically the same as
<pre>
int a;
string s;
// ...code that calculates 'a'
if (a)
s = "True";
else
s = "False";
</pre>
but the advantage of the conditional operator is that it can be used in
an expression.
<p>
The <i>Comma</i> operator is used to evaluate a sequence of expressions
from left to right, using the type and value of the right operand as
the result.
<p>
Note that arguments in a function call as well as multiple variable declarations
also use commas as delimiters, but in that case this is <b>not</b> a
comma operator!
<hr>
<table width=100% cellspacing=0 border=0><tr><td align=left><font face=Helvetica,Arial>
<a href=index.htm>Index</a>
</font></td><td align=right><font face=Helvetica,Arial size=-1>
<i>Copyright © 2005 CadSoft Computer GmbH</i>
</font></td></tr></table>
<hr>
</font>
</body>
</html>
|