File: 222.htm

package info (click to toggle)
eagle 4.16-5
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 36,508 kB
  • sloc: sh: 82; makefile: 32
file content (53 lines) | stat: -rw-r--r-- 1,637 bytes parent folder | download | duplicates (2)
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
<html>
<head>
<title>EAGLE Help: for</title>
</head>
<body bgcolor=white>
<font face=Helvetica,Arial>
<hr>
<i>EAGLE Help</i>
<h1><center>for</center></h1>
<hr>
The <i>for</i> statement has the general syntax
<pre>
for ([init]; [test]; [inc]) statement
</pre>
and performs the following steps:
<ol>
<li>If an initializing expression <tt>init</tt> is present, it is executed.
<li>If a <tt>test</tt> expression is present, it is executed. If the result
is nonzero (or if there is no <tt>test</tt> expression at all), the
<tt>statement</tt> is executed.
<li>If an <tt>inc</tt> expression is present, it is executed.
<li>Finally control returns to step 2.
</ol>
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>inc</tt> expression (or the
<tt>statement</tt>) must affect
the value of the <tt>test</tt> expression, or <tt>test</tt> itself must
change during evaluation in order to avoid an endless loop.
<p>
The initializing expression <tt>init</tt> normally initializes one or more
loop counters. It may also define a new variable as a loop counter.
The scope of such a variable is valid until the end of the active block.
<p>
<b>Example</b>
<pre>
string s = "Trust no one!";
int sum = 0;
for (int i = 0; s[i]; ++i)
    sum += s[i]; // sums up the characters in s
</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 &copy; 2005 CadSoft Computer GmbH</i>
</font></td></tr></table>
<hr>
</font>
</body>
</html>