Control Structures:
If...Then...Else:
If condition1 Then
statements1
Else
statements2
End If
If condition1 is True, then statements1 block is executed; Else, condition1 is not True, therefore statements2 block gets executed. The structure must be terminated with the End If statement.
The Else clause is optional. In a simple comparison, statements1 get executed or not.
If condition1 Then
statements1
End If
Select Case:
Can be used as an alternative to the If...Then...Else structure, especially when many comparisons are involved.
Select Case ShirtSize
Case 1
SizeName.Caption = "Small"
Case 2
SizeName.Caption = "Medium"
Case 3
SizeName.Caption = "Large"
Case 4
SizeName.Caption = "Extra Large"
Case Else
SizeName.Caption = "Unknown size"
End Select
0 comments:
Post a Comment