While

You can use the statement While to repeat a loop based on a condition.

Syntax

 While <Boolean expression>
Do
...;
Od;

The condition is evaluated before every iteration of the loop. If the condition evaluates to True, the loop is executed. If the condition evaluates to False, KCM Core continues with the next statement following Od.

You can use the Break command to terminate the loop unconditionally.

Example

Parameter Text String;

While String <> ""
Do
  Progress Message (substring (String, 1, 1));
  String = rsubstring (String, 2, 0);
Od;

This script sends all characters from the parameter to the client, one character at a time. Note the use of rsubstring. This function returns the input string minus the first character: the 2 parameter takes care of that, and the 0 parameter says that no characters must be left out from the end of the input string.