While Break Example

This example shows how to use the {this.break()} viper to break out of a while loop. This viper can also be used in the dowhile macro.

Smartsite SXML CopyCode image Copy Code
{buffer.set(i, 1)}
<se:while expression="i != 10" whitespace="remove">
    i = {buffer.get(i)}
    {sys.iif($i == 5, this.break())}
    {buffer.set(i, $i + 1)}
    {char.crlf()}
</se:while>
Done.
Example Result CopyCode image Copy Code
i=1
i=2
i=3
i=4
i=5

Done.