Examples: If...GoTo statement
Ask the user to propose a down payment for a house. Elsewhere, the cost has been set at $235,000. Depending on whether or not the user proposes a down payment of at least 10% of cost, respond accordingly.
Sub ProcessMortgage(cost As Single)
Dim downpmt As Single, msg As String
msg$ = "Cost: " + Format(cost!, "Currency") _
& ". Enter a down payment:"
downpmt! = CSng(InputBox(msg$))
If downpmt! < .1 * cost! GoTo NotEnough
msg$ = Format(downpmt!, "Currency") & " will do fine!"
MessageBox msg$
' Continue processing the application
' ...
' ...
Exit Sub
NotEnough:
msg$ = "Sorry, " & Format(downpmt!, "Currency") _
& " is not enough!"
MessageBox msg$
End Sub
Dim cost As Single
cost! = 235000
ProcessMortgage(cost!) ' Call the ProcessMortgage sub.