Runs an alternate block of statements when an If or ElseIf statement condition is False. The statements in the If or ElseIf statement are skipped and the statements in the Else block run.
Syntax
If condition Then
[Statements]
[Else
[ElseStatements]]
End If
Arguments
| Argument | Description |
|---|---|
| ElseStatements | One or more statements to run when the If or ElseIf statement condition is False. |
Example
currentHour = Hour(Now())
Print("Time of day is ")
If (6 <= currentHour) and (currentHour < 12) Then
PrintLn("morning")
ElseIf (12 <= currentHour) and (currentHour < 18) Then
PrintLn("afternoon")
ElseIf (18 <= currentHour) and (currentHour < 24) Then
PrintLn("evening")
Else
PrintLn("night")
End If