Loop - Break

Declaration

<AMBREAK />

Description: Breaks out of a Loop or If statement.

Practical Usage

Can be used inside a Loop activity to break out of the loop if a particular condition takes place.

Example

The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.

This sample task loops 6 times and examines the current value to see if it is greater than or equal to 3 during each iteration. If the value is greater than or equal to 3, the task breaks out of the loop using the Break action.

<AMVARIABLE NAME="indexvar"></AMVARIABLE>
<AMLOOP TOTALLOOPS="6" RESULTVARIABLE="indexvar">
<AMSHOWDIALOG>%indexvar%</AMSHOWDIALOG>
<AMIF EXPRESSION="%indexvar% &gt;= 3">
<AMBREAK />
</AMIF>
</AMLOOP>