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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.