Optional Part of Block

The Else part of the block is optional. Sometimes you want to test for a certain condition, and if that condition is True, execute some code - but if it's False, there's no code to execute. For example, we could add another If...End...If block to our script:

Dim Greeting
Dim UserName
UserName = InputBox("Please enter your name:")
UserName = Trim(UserName)
If UserName = " " Then
Greeting = "Why won't you tell me your name? That's not very nice."
Else
Greeting = "Hello, " & UserName & ", it's a pleasure to meet you."
End If
If UserName = "Mike" Then
Greeting = Greeting & " I like the name Mike."
End If
MsgBox Greeting

First
Next