IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesPerl  Print This     

Comparison Operators (Perl and Access VBA Cross Reference Guide)

By Mike Prestwood

Perl versus Access VBA: A side by side comparison between Perl and Access VBA.

 
Operators
 

A language symbol used for assignment, comparison, computational, or as a logical.

Comparison Operators

[Other Languages] 

General Info: Round Floating Point Numbers

When comparing floating point numbers, make sure you round to an acceptable level of rounding for the type of application you are using.

Languages Focus

A comparison operator compares two values either literals as in "Hello" and 3 or variables as in X and Counter. Most languages use the same operators for comparing both numbers and strings. Perl, for example, uses separate sets of comparison operators for numbers and strings.

Perl:   ==, !=

Common comparison operators:

== equal
!= not equal
< less than
> greater than
<= less than or equal
>= greater than or equal

Perl also offers additional string comparison operators:

eq string equals
ne string not equal
lt string less than
gt string greater than
le string less than or equal
ge string greater than or equal

Syntax Example:
#Does Perl evaluate the math correctly? No!
if ((.1 + .1 + .1) == .3) {
print("Correct<br>");
} else {
print("Not correct<br>");
}
Access VBA:   =, <>

Save as VB Classic. Common comparison operators:

= equal
<> not equal
< less than
> greater than
<= less than or equal
>= greater than or equal

Syntax Example:
//Does Access evaluate the math correctly? No!
If 0.1 + 0.1 + 0.1 = 0.3 Then
MsgBox "correct"
Else
MsgBox "not correct"
End If












Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]