Skip to main content

CSP Tags: <csp:while>

The <csp:while> tag repeats a code block while evaluation of its controlling condition yields true.

Add the code shown below to MySamplePage.CSP between <body> and </body>. The loop executes OddEvenTest ten times sending the numbers 1-10 to OddEvenTest. You can remove all other code from between <body> and </body>.

<script language="Cache" runat="Server">
Set i=0
<csp:while condition="i<10" counter="j">
<script language="Cache" runat="Server">
Set i=i+1

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

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

generated description: whileloop20142

FeedbackOpens in a new tab