Skip to main content

CSP Tags: <csp:loop>

The <csp:loop> tag repeats a code block a specified number of times.

Add the code shown below to MySamplePage.CSP between <body> and </body>. The code executes OddEvenTest ten times placing the result in a bulleted list. You can remove any other code from between <body> and </body>.

<body>
<ul>
<csp:loop counter="i" from="1" to="10" step="1">
<li>#(..OddEvenTest(i))#</li>
</csp:loop>
</ul>

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

Click View —> Web Page to view MySamplePage.CSP in a Web browser.

generated description: looptag20142

FeedbackOpens in a new tab