Skip to content

MvWHILESTOP#


An loop can be explicitly halted using the tag to exit the loop. Execution jumps to the code following the closing tag.

Sytax
<MvWHILESTOP> 

Care must be taken to ensure an endless loop is not created. The Empresa engine will eventually time out, but the loop will consume server resources until that happens. The <MvWHILESTOP> command can be used to exit a loop at any time.

Breaking out of a loop. Loops can be ended manually using <MvWHILESTOP>, for example when an error is detected, or to prevent an endless loop.

Example#

<MvWHILE EXPR = "{ 1 }">
    Execute the code here endlessly.

    <MvIF EXPR="{ g.counter GE 100 }">
        <MvWHILESTOP>
    </MvIF>
    <MvASSIGN name="g.counter" value="{ g.counter + 1}"> 
</MvWHILE>