| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
|
| Relational and Logical Operations |
|
Relational Operators
|
|
Visual Basic supplies a set of six relational operators to compare the magnitudes of two data values and comparisons can be made with numeric or string values, with a Boolean value returned from the comparison.
|
|
The following table summarizes these relational operators
|
| Operator |
Use |
| = |
Tests whether two values are equal. |
| <> |
Tests whether two values are not equal. |
| < |
Tests whether the first value is less than the second value. |
| > |
Tests whether the first value is greater than the second value. |
| <= |
Tests whether the first value is less than or equal to the second
value. |
| >= |
Tests whether the first value is greater than or equal to the second
value. |
|
|
In the following example,the Boolean value True is assigned to Result2 and the Boolean value False is assigned to variable Result1.Value1 is not equal to Value2; rather, Value1 is less than Value2.
|
Dim Value1 As Decimal = 10
Dim Value2 As Decimal = 20
Dim Result1 As Boolean
Dim Result2 As Boolean
Result1 = Value1 = Value2
Result2 = Value1 < Value2
|
|
|
Logical Operators
|
|
Relational tests can be combined to test multiple conditions at the same time and the logical operators AND, OR, NOT, and Xor are used as conjunctions between multiple relational tests.
In the following example, all of the complex relational tests are True and notice in the third relational test that parentheses are used, just as in composing arithmetic expressions, to control the order in which tests are made.
|
Dim Value1 As Decimal = 10
Dim Value2 As Decimal = 20
Dim Value3 As Decimal = -5
Dim Result1 As Boolean
Dim Result2 As Boolean
Dim Result3 As Boolean
Result1 = Value1 < Value2 AND Value1 > Value3
Result2 = Value1 > Value2 OR Value1 > Value3
Result3 = Value1 < Value2 AND (Value1 > Value3 OR Value2 < Value3)
|
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
relational operators,
logical operators,
logical operator,
logical shift,
relational database,
division operations,
relational databases,
bitwise logical,
logical math,
math operations,
logical arithmetic,
relational design,
logical mathematical,
java logical,
boolean logical,
relational system,
logical database,
logical databases,
logical design
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
|