<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="mmres://user_interface_reference.css" rel="stylesheet" type="text/css">
<title>CFLOOP: 条件付きループ</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
   <div id="説明">
   <table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
      <tr> 
         <td valign="top" class="name">CFLOOP: 条件付きループ</td>
         <td valign="top" nowrap class="compatibility">&nbsp;</td>
      </tr>
      <tr>
         <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
      </tr>


    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">説明</span>
<p>
条件付きループは、条件が true であるかぎり、一連の命令を繰り返します。このタイプのループを正しく使用するためには、ループが繰り返されるたびに条件を変更する命令を記述し、条件が false になるまでそれを行う必要があります。条件付きループは、&quot;この条件が TRUE である間はループする&quot; という意味で、WHILE ループ とも呼ばれます。
</p>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="syntax"><span class="title">シンタックス</span><pre>&lt;cfloop
   condition = &quot;expression&quot;&gt;
   ...
&lt;/cfloop&gt;
</pre>    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">関連項目</span>
<p>
cfabort、cfbreak、cfexecute、cfexit、cfif、cflocation、cfswitch、cfthrow、cftry、『ColdFusion MX 開発ガイド』の第2章の「CFML の要素」 の「cfloop と cfbreak」
</p>

<p>

</p>
    </td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="CLEARSEPARATION">&nbsp;</td>
  </tr>
  <tr>
    <td valign="top" colspan="2" class="description"><span class="title">例</span>
<p>
次の例では、CountVar が 1 から 5 まで 1 ずつ加算されています。 
</p>
<pre>&lt;!--- 変数 CountVar を 0 に設定します。 ---&gt; 
&lt;cfset CountVar = 0&gt;
&lt;!--- CountVar = 5 になるまでループします。 ---&gt;
&lt;cfloop condition = &quot;CountVar LESS THAN OR EQUAL TO 5&quot;&gt;
   &lt;cfset CountVar = CountVar + 1&gt;
   ループインデックスは &lt;cfoutput&gt;#CountVar#&lt;/cfoutput&gt; です。&lt;br&gt;
&lt;/cfloop&gt;
</pre>
<p>
このループの出力は次のとおりです。 
</p>
<pre>ループインデックスは 1 です。
ループインデックスは 2 です。
ループインデックスは 3 です。
ループインデックスは 4 です。
ループインデックスは 5 です。
</pre>
         </td>
      </tr>
   </table>
   </div>
<div id="CONDITION">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>  
<td valign="top" class="name">CONDITION</td>
  <td valign="top" nowrap class="compatibility">&nbsp;</td>
  </tr>
  <tr>
  <td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
  </tr>

  <tr>
  <td valign="top" class="syntax">&nbsp;</td>
  <td valign="top" nowrap class="requirements">必須</td>
  </tr>
  <tr>
  <td colspan="2" class="clearseparation">&nbsp;</td>
  </tr>
  <tr>
  <td valign="top" colspan="2" class="description">



<p>ループを制御するための条件です。</p>

  </td>
  </tr>
  </table>
</div>

  </body>
</html>
