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
|
<html>
<head>
<title>EAGLE Help: while</title>
</head>
<body bgcolor=white>
<font face=Helvetica,Arial>
<hr>
<i>EAGLE Help</i>
<h1><center>while</center></h1>
<hr>
The <i>while</i> statement has the general syntax
<pre>
while (condition) statement
</pre>
and executes the <tt>statement</tt> as long as the <tt>condition</tt>
expression is not zero.
<p>
The <tt>condition</tt> is tested <b>before</b> the first possible
execution of <tt>statement</tt>, which means that the statement may never
be executed if <tt>condition</tt> is initially zero.
<p>
If there is no
<tt><a href=219.htm>break</a></tt> or
<tt><a href=224.htm>return</a></tt>
inside the <tt>statement</tt>, the <tt>statement</tt> must affect
the value of the <tt>condition</tt>, or <tt>condition</tt> itself must
change during evaluation in order to avoid an endless loop.
<p>
<b>Example</b>
<pre>
string s = "Trust no one!";
int i = 0;
while (s[i])
++i;
</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>
|