If...then...else statement, If...then...else statement -7 – Sensaphone SCADA 3000 Users manual User Manual

Page 239

Advertising
background image

22-7

Chapter 22: Distributed Control using Visual Basic

Usage

Dim varname[([subscripts])][, varname[([subscripts])]] . . .

Arguments
varname

Name of the variable; follows standard variable naming conventions.

subscripts

Dimensions of an array variable; up to 60 multiple dimensions may be declared.

The subscripts argument uses the following syntax:

upperbound [,upperbound] . . .
The lower bound of an array is always zero.

variable name definitions
A named storage location that can contain data that can be modified during program execution.

Each variable has a name that uniquely identifies it within its level of scope.
Variable names:

• Must begin with an alphabetic character.
• Can’t contain an embedded period or type-declaration character.
• Must be unique within the same scope.
• Must be no longer than 255 characters.

If...Then...else Statement

Conditionally executes a group of statements, depending on the value of an expression.

If condition Then statements [Else elsestatements ]
Or, you can use the block form syntax:
If condition Then
[statements]
[ElseIf condition-n Then
[elseifstatements]] . . .
[Else
[elsestatements]]
End If

Arguments
condition

One or more of the following two types of expressions:
A numeric or string expression that evaluates to True or False. If condition is

Null, condition is treated as False.

An expression of the form TypeOf objectname Is objecttype. The objectname is any

object reference and objecttype is any valid object type. The expression is True if

objectname is of the object type specified by objecttype; otherwise it is False.

statements

One or more statements separated by colons; executed if condition is True.

Advertising