Open-Source-Software-Entwicklung und Downloads

Browse Subversion Repository

Contents of /trunk/doc/en/html/macro/appendixes/negative.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3227 - (show annotations) (download) (as text)
Tue Mar 24 15:10:33 2009 UTC (15 years, 1 month ago) by maya
File MIME type: text/html
File size: 946 byte(s)
CVS から SVN へ移行: 改行コードを LF から CR+LF へ変換
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html>
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <title>Note on negative integer constants</title>
7 <meta http-equiv="Content-Style-Type" content="text/css">
8 <link rel="stylesheet" href="../../style.css" type="text/css">
9 </head>
10 <body>
11
12 <h1>Note on negative integer constants</h1>
13
14 <p>
15 Using a negative integer constant may cause a problem like the following: For example,
16 </p>
17
18 <pre><code>for i -10 0</code></pre>
19
20 <p>
21 causes the syntax error, because the second parameter is regarded as "i-10" instead of "i". To avoid this problem, take one of the following solutions:
22 </p>
23
24 <ol>
25 <li>Put "0" before "-".
26 <pre><code>for i 0-10 0</code></pre>
27 </li>
28
29 <li>Assign the negative constant to a variable.
30 <pre><code>A = -10
31 for i A 0
32 </code></pre>
33 </li>
34 </ol>
35
36 </body>
37 </html>

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26