33
BREAK Directive
Immediate Exit of Loop
Format
BREAK
Description
Use the BREAK directive to perform an immediate exit from a loop or case structure.
Execution resumes following the directive that would normally have ended the loop
or case structure (e.g., NEXT, or WEND). The *BREAK label emulates a BREAK
directive for use as a statement reference.
Note: You can now use BREAK commands in SELECT structures. In earlier version of
ProvideX, BREAK and the corresponding *BREAK label were not supported for use
with SELECT..NEXT RECORD directives.
See Also
Flow Overrides in the ProvideX User's Guide
Examples
00100
PROCESS_TAXCODE:
00110
LiquorTax=0,SalesTax=0,ServiceTax=0
00120
SWITCH UCS(TaxCode$)
00130
CASE "X","Z" ! two codes are tax exempt
00140
BREAK ! stop processing for case "X" here
00150
CASE "L" ! liquor pays all liquor,sales and service tax
00160
LiquorTax=cost*LiquorTaxRate
00170
! no break here, logic falls through
00180
CASE "S" ! pays sales and service tax
00190
SalesTax=cost*SalesTaxRate
00200
! no break here, logic falls through
00210
CASE "V" ! service tax
00220
ServiceTax=cost*ServiceTaxRate
00230
BREAK ! end processing for this case and any that fell through
00240
DEFAULT ! enter here if case not found
00250
MSGBOX "Unknown tax code","Error"
00260
END SWITCH
00270
TotalTax=LiquorTax+SalesTax+ServiceTax
00280
RETURN