18.01.2013 Views

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

VBScript Reference Manual for InduSoft Web Studio

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>VBScript</strong> <strong>Reference</strong> <strong>Manual</strong> <strong>InduSoft</strong> <strong>Web</strong> <strong>Studio</strong><br />

Empty Variables<br />

Empty is a single <strong>VBScript</strong> variable that has been declared, but has no explicitly assigned value. This is<br />

also known as an uninitialized variable. There are two ways a variable can be uninitialized. The first is<br />

when it is explicitly declared but has not yet been assigned a value. For example:<br />

Dim a, b<br />

a = 2 ‘ a is initialized, b is still uninitialized<br />

The second way a variable can be uninitialized is by assigning it a value of Empty. Empty is <strong>VBScript</strong><br />

keyword. For example:<br />

a = 2 ‘ a is a integer variable<br />

b = “Hello” ‘ b is a string variable<br />

a = Empty ‘ makes variable a uninitialized<br />

b = Empty ‘ makes variable b uninitialized<br />

If the variable was a numeric data subtype and set to a value of Empty (making it a Empty subtype), its<br />

value will be 0. If the variable was a string data subtype and set to a value of Empty, its value will be “”.<br />

The numeric and string subtypes can still be used in statements without generating a <strong>VBScript</strong> error<br />

although their values were set to Null<br />

Note that a variable being Empty is different that variable having a Null value. An Empty variable is<br />

uninitialized, while a Null variable contains no valid data.<br />

Error Variables<br />

A variable with an Error data subtype contains an error number generated by the <strong>VBScript</strong> Parser or<br />

Runtime Engine (signifying the <strong>VBScript</strong> Syntax error or Runtime error). An Error variant data subtype<br />

can only be created by the <strong>VBScript</strong> Parser or Runtime Engine, or by calls to <strong>VBScript</strong> Object Methods.<br />

The programmer cannot directly create or manipulate Error data subtypes.<br />

See the Err Object <strong>for</strong> examples of how to use errors.<br />

Null Variables<br />

A Null variable is a single variable that indicates the variable contains no valid data. A null value is<br />

typically used to represent missing data. A variable becomes a Null variable when it is assigned a null<br />

value by using the Null keyword. For example:<br />

Dim a, b<br />

a = 2 ‘ a is initialized, b is uninitialized<br />

a = Null ‘ a is Null, b is uninitialized (Empty)<br />

One of the main differences between Empty and Null is that a variable can be of type Empty<br />

(uninitialized) when it is declared but not assigned a value, or when it is assigned a value of Empty. A<br />

Null variable, on the other hand, must be assigned a Null value.<br />

72 <strong>InduSoft</strong>, Ltd.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!