Break

Syntax

BREAK [ ALL ]

Parameters

Break can be abbreviated as BK.

Description

The Break logic command terminates a logic loop. The loop is terminated at the point at which the Break logic statement is invoked, and processing proceeds to the logic following the end of the loop.

If executed in a frame method, the Break logic command will not terminate a loop from which the frame was invoked. If this is required, it must be specified separately.

Break All

The Break All logic command variant terminates all current loops. In insertable classes, this includes loops in the logic in which the insertable class is inserted. In segment methods, this does not include loops in the logic from which the segment method is called.

Examples

Example 1

This example obtains a total for a customer's invoice amounts.

Determine From Invoice (Customer, Invoice_No)
    If (Event.Customer <> Customer)
          Break
    End
    Cust_Total := Cust_Total + Event.Amount
End

Example 2

This example verifies a customer's credit level.

Determine Every Sale (Customer)
	    SalePrice := SalePrice * Quantity
	    Total := Total + SalePrice
	    If Total > Cust.Limit
	           Break
	    End
End

Example 3

This example, in the Main method of a report, ensures only a valid product name is accepted.

Loop
	    Message Attention "Enter Product Name"
	    Accept SD_Prod
	    LookUp SD_Prod Prod
	    If (Glb.Status <> "*****")
		         Break
	    End
	    Message SD_Prod "Product name not valid"
End