例: If...Then...ElseIf statement

Dim quantity As Integer, pctDiscount As Single
Dim unitPrice As Currency, total As Currency
unitPrice@ = 3.69
quantity% = 50
' Define discount based on quantity purchased.
If quantity% > 99 Then
   pctDiscount! = .20
ElseIf quantity% > 49 Then
   pctDiscount! = .10
Else
   pctDiscount! = 0
End If
total = (quantity% * unitPrice@) * (1 - pctDiscount!)
Print   "Unit price: $"; unitPrice@, _
  "Quantity: "; quantity%, _
  "Discount%: "; pctDiscount!, _
  "Total: $"; total@