If-Then-Else

An If-Then-Else is a code structure used to make a decision based on the result of a simple or compound condition.  It specifies the code to execute when the result is True, and the code to execute when the result is false.

The syntax for an If-Then-Else is:

If <condition> Then

<code to execute>

Else

<code to execute>

End If

An If-Then-Else code structure must follow this format.  The words in blue are key (or reserved) words.

If (x = 5) Then

y = 15
z = 25

Else

y = 0
z = 0

End If