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
|
<html>
<head>
<title>EAGLE Help: if...else</title>
</head>
<body bgcolor=white>
<font face=Helvetica,Arial>
<hr>
<i>EAGLE Help</i>
<h1><center>if...else</center></h1>
<hr>
The <i>if...else</i> statement has the general syntax
<pre>
if (expression)
t_statement
[else
f_statement]
</pre>
The conditional <tt>expression</tt> is evaluated, and if its value is nonzero
the <tt>t_statement</tt> is executed. Otherwise the <tt>f_statement</tt> is
executed in case there is an <tt>else</tt> clause.
<p>
An <tt>else</tt> clause is always matched to the last encountered <tt>if</tt>
without an <tt>else</tt>. If this is not what you want, you need to use
<a href=149.htm>braces</a> to group the statements, as in
<pre>
if (a == 1) {
if (b == 1)
printf("a == 1 and b == 1\n");
}
else
printf("a != 1\n");
</pre>
<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>
|