Using Comparison Operators

Visual Basic .NET supports the comparison operators listed in Table 4-4. If both operands are numeric, Visual Basic .NET compares them numerically. If one or both are characters or strings, Visual Basic .NET compares them as text.

Table 4-4. Visual Basic .NET Comparison Operators

Comparison Operator

Description

=

Equal

<>

Not equal

<

Less than

>

Greater than

<=

Less than or equal

>=

Greater than or equal

Like

Matches pattern

Is

Returns True if both operands point to the same object

Comparing Numbers

The rules for comparing two numbers are essentially the same as those for performing arithmetic on them. If the numbers have different data types, Visual Basic .NET temporarily converts the narrower type ...

Get Faster Smarter Beginning Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.