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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Subtraction Operator (-)<br />

Description Finds the difference between two numbers or indicates the negative value of a numeric<br />

expression.<br />

Usage result = number1 - number2 (Syntax 1)<br />

result = - number (Syntax 2)<br />

Arguments result<br />

Any numeric variable.<br />

number1<br />

Any valid numeric expression.<br />

number2<br />

Any valid numeric expression.<br />

number<br />

Any valid numeric value or numeric expression<br />

Remarks In Syntax 1, the - operator is the arithmetic subtraction operator used to find the difference<br />

between two numbers. In Syntax 2, the - operator is used as the unary negation operator to<br />

indicate the negative value of an expression. If one or both expressions are Null expressions,<br />

result is Null. If an expression is Empty, it is treated as if it were 0.<br />

Example: MyResult = 5 - 4 ' MyResult is 1<br />

a = 5<br />

MyResult = -a ‘ MyResult is -5<br />

MyResult = -(5-4) ‘ MyResult is -1<br />

Xor Operator (Xor)<br />

Description Per<strong>for</strong>ms a logical exclusion on two expressions.<br />

Usage result = expression1 Xor expression2<br />

Arguments result<br />

Any variable.<br />

expression1<br />

Any valid expression.<br />

expression2<br />

Any valid expression.<br />

Remarks If one, and only one, of the expressions evaluates to True, result is True. However, if either<br />

expression is Null, result is also Null. When neither expression is Null, result is determined<br />

according to the following table:<br />

If expression1 is And expression2 is Then result is<br />

True True False<br />

True False True<br />

False True True<br />

False False False<br />

The Xor operator also per<strong>for</strong>ms a bitwise comparison of identically positioned bits in two numeric<br />

expressions and sets the corresponding bit in result according to the following table:<br />

If bit in expression1 is And bit in expression2 is Then result is<br />

0 0 0<br />

0 1 1<br />

1 0 1<br />

1 1 0<br />

See also And Operator, Not Operator, Or Operator<br />

Example: Dim cond1, cond2, flag<br />

cond1 = True<br />

cond2 = False<br />

If (cond1 = True) Xor (cond2 = True) Then<br />

flag = True<br />

Else<br />

flag = False<br />

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

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

Saved successfully!

Ooh no, something went wrong!