Directives 

CASE

Define Branch Points

Format

CASE range[$]
  
Where: 

range[$]

List of values defining branch points in a program. String or numeric expression.

Description

Use the CASE directive to list possible branch points in a program.

See Also

SWITCH Branch Control
BREAK Immediate Exit of Loop
DEFAULT Branch If No Matching Case

Example

PROCESS_TAXCODE:
     LiquorTax=0,SalesTax=0,ServiceTax=0
     switch ucs(TaxCode$)
          case "X","Z" ! two codes are tax exempt
               break ! stop processing for case "X" here
          case "L" ! liquor pays all liquor,sales and service tax
               LiquorTax=cost*LiquorTaxRate
! no break here, logic falls through
          case "S" ! pays sales and service tax
               SalesTax=cost*SalesTaxRate
! no break here, logic falls through
          case "V" ! service tax
               ServiceTax=cost*ServiceTaxRate
               break ! end processing for this case and any that fell through
          default ! enter here if case not found
               msgbox "Unknown tax code","Error"
     end switch
     TotalTax=LiquorTax+SalesTax+ServiceTax
     return