ID : 132
If...End If
Function
To execute statements between If and End If.
Syntax
If condition Then 'Statemets ElseIf condition n Then 'Statements-n Else 'ElseStatements End If
Guaranteed entry
- Condition
- Designate a conditional expression and determine "True"/"False."
Description
Subsequent Statements are executed if the designated condition is True. You can use "ElseIf" to designate more than one condition. Statements subsequent to the condition that becomes True are executed first and then those subsequent to "End If" are executed.
If no condition becomes True, Statements subsequent to "Else" are executed.
Attention
-
Example
'!TITLE "Executing Conditional Judgment of Conditional Expression between If and End If"
' Execute magnitude determination of aaa and bbb
Sub Sample_IfEndIf
Dim aaa As Integer
Dim bbb As Integer
aaa = 1
bbb = 2
' Execute magnitude determination
If aaa < bbb Then
' Display the determination result (aaa < bbb) on the message output window
PrintDbg ( aaa & " < " & bbb )
End If
End Sub
ID : 132