• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

13. Control Statements > 13.1. The If ...Then Statement

The If ...Then Statement

The If...Then statement is used for conditional control. The syntax is:

IfCondition Then
   ' statements go here . . .
ElseIf AnotherCondition Then
   ' more statements go here . . .
Else
   ' more statements go here . . .
End If

Note that we may include more than one ElseIf part, and that both the ElseIf part(s) and the Else part are optional. We can also squeeze all parts of this statement onto a single line, which is generally only a good idea when the ElseIf and Else parts are not required.

To illustrate, the following code checks to see if the FirstName field is null. If so, it replaces the Null value with a question mark. If not, it capitalizes the first name.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint