Open-Source-Software-Entwicklung und Downloads

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3221 - (show annotations) (download) (as text)
Tue Mar 24 09:37:20 2009 UTC (15 years, 2 months ago) by maya
File MIME type: text/html
File size: 914 byte(s)
CVS から SVN へ移行: trunk に集約
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=Shift_JIS">
6 <title>負の整数定数についての注意</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>負の整数定数についての注意</h1>
13 <p>
14 コマンドのパラメータに負の整数定数を使用する場合、以下のような問題が発生する場合がある。例えば、
15 </p>
16
17 <pre><code>for i -10 0</code></pre>
18
19 <p>
20 このコマンドは文法エラーを発生する。なぜなら、2番めのパラメータは "i" ではなくて、"i-10" とみなされるからである。この問題を防ぐには以下のいずれかの方法をとる。
21 </p>
22
23 <ol>
24 <li>"-" の前に "0" をつける。
25 <pre><code>for i 0-10 0</code></pre>
26 </li>
27
28 <li>負の整数定数を変数に代入してから使用する。
29 <pre><code>A = -10
30 for i A 0
31 </code></pre>
32 </li>
33 </ol>
34
35 </body>
36 </html>

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