Conditional Branching

Unconditional branching is just calling a subroutine or function on the subsequent line.
There are several different ways you can implement conditional branching.


If - Then - Else

If - Then - Else

If (iValue > 10) Then 
   Call MsgBox("number is greater than 10")
Else
   Call MsgBox("number is less than or equal to 10")
End If

Select - Case

Select - Case

Select Case sText 
   Case "Match 1": Call Proc1()
   Case "Match 2": Call Proc2()
   Case Else: Call Proc3()
End Select

IIF

Immediate IF

Dim iNumber As Integer 
iNumber = 50
Call Msgbox( IIf( iNumber > 40, "over forty", "less than forty") )


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext