Changes

Jump to: navigation, search

Visual Basic Comparison and Logic

692 bytes removed, 18:42, 7 August 2007
Visual Basic Logical Operators
Then we would use the Visual Basic ''Or'' operator in our If statement:
 
''Logical Operators'' are also known as ''Boolean Operators'' because they evaluate parts of an expression and return a ''True'' or ''False'' value, allowing decisions to be made about how a script should proceed.
 
The first step to understanding how logical operators work is to construct a sentence rather than to look at a script example right away. Let's assume we need to check some aspect of two variables named intVal1 and intVal2. Our sentence might read:
 
''If intVal1 is less than 25 AND intVal2 is greater than 45 display a message.''
 
Here the logical operator is the "AND" part of the sentence. If we were to express this in Visual Basic we would use the AND logical operator
<pre>
<pre>
(10 > 1) // ' returns ''True''
Not(10 > 1) // ' returns ''False'' because we have inverted the result with the logical NOT
</pre>

Navigation menu