Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.Opens in a new tab

For information on migrating to InterSystems IRISOpens in a new tab, see Why Migrate to InterSystems IRIS?

CSP タグ : <csp:while>

<csp:while> タグは、制御条件の評価が True である限り、コード・ブロックを繰り返します。

MySamplePage.CSP ページの <body></body> のタグの間に、以下のようにコードを追加します。このループは OddEvenTest を 10 回実行し、1 ~ 10 の数値を OddEvenTest に送信します。<body></body> の間にあるその他のコードはすべて削除できます。


<body>
<script language="Cache" runat="Server">
Set i=0
</script>
<ul>
<csp:while condition="i<10" counter="j">
<li>#(..OddEvenTest(j))#</li>
<script language="Cache" runat="Server">
Set i=i+1
</script>
</csp:while>
</ul>

<script language="cache" method="OddEvenTest" arguments="val1:%Integer"
returntype="%String">
  If (val1#2=0) { quit "even" }
  Else {quit "odd"}
</script>
</body>

[ビュー]→[ウェブページ] をクリックして、Web ブラウザで MySamplePage.CSP を表示します。

generated description: whileloop20142

FeedbackOpens in a new tab