Testing Conditions in VBScript

VBScript provides one control structure for making decisions—the If...Then...Else structure. To make a decision, you supply one or more expressions that evaluate to True or False. Which code is executed depends on what your expressions evaluate to.

The simplest form of If...Then...Else uses only the If...Then part. If the specified condition is true, the code following the condition is executed; if not, that code is skipped. In the following code fragment, for example, the message appears only if the variable x is less than pi:

If (x < pi) Then document.write("x is less than pi")

You can use any expression as the condition. Because you can nest and combine expressions with the logical operators, your tests can ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.