Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


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

10. The Language Reference > If . . . Then . . . Else Statement

Name

If . . . Then . . . Else Statement

Syntax

If condition Then
    [statements]
[ElseIf condition-n Then
    [elseifstatements] ...
[Else
    [elsestatements]]
End If

Or, you can use the single-line syntax:

If condition Then [statements] [Else elsestatements]
condition

Use: Required

Data Type: Boolean

An expression returning either True or False or an object type.

statements

Use: Optional

Program code to be executed if condition is True.

condition-n

Use: Optional

Same as condition.

elseifstatements

Use: Optional

Program code to be executed if the corresponding condition-n is True.

elsestatements

Use: Optional

Program code to be executed if the corresponding condition or condition-n is False.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint