# 比较运算符Comparison operators

## 语法Syntax

result = _表达式_1 comparisonoperator _表达式_2result = expression1 comparisonoperator expression2

PartPart 说明Description
resultresult 必需，任何数值变量Required; any numeric variable.
expressionexpression 必需；任何表达式。Required; any expression.
comparisonoperatorcomparisonoperator 必需；任何比较运算符。Required; any comparison operator.
objectobject 必需；任何对象名称。Required; any object name.
stringstring 必需；任何字符串表达式Required; any string expression.
patternpattern 必需；任何字符串表达式或字符范围。Required; any string expression or range of characters.

## 备注Remarks

OperatorOperator 满足以下条件时为 TrueTrue if 满足以下条件时为 FalseFalse if 满足以下条件时为 NullNull if
`<`(小于)`<` (Less than) 表达式 < 2_表达式_2expression1 < expression2 表达式 >= 2_表达式_2expression1 >= expression2 表达式_1 或_表达式 = 2Nullexpression1 or expression2 = Null
`<=`(小于或等于)`<=` (Less than or equal to) 表达式 <= 2_表达式_2expression1 <= expression2 表达式 > 2_表达式_2expression1 > expression2 表达式_1 或_表达式 = 2Nullexpression1 or expression2 = Null
`>`(大于)`>` (Greater than) 表达式 > 2_表达式_2expression1 > expression2 表达式 <= 2_表达式_2expression1 <= expression2 表达式_1 或_表达式 = 2Nullexpression1 or expression2 = Null
`>=`(大于或等于)`>=` (Greater than or equal to) 表达式 >= 2_表达式_2expression1 >= expression2 表达式 < 2_表达式_2expression1 < expression2 表达式_1 或_表达式 = 2Nullexpression1 or expression2 = Null
`=`(等于)`=` (Equal to) 表达式 = 2_表达式_2expression1 = expression2 表达式 <> 2_表达式_2expression1 <> expression2 表达式_1 或_表达式 = 2Nullexpression1 or expression2 = Null
`<>`(不等于)`<>` (Not equal to) 表达式 <> 2_表达式_2expression1 <> expression2 表达式 = 2_表达式_2expression1 = expression2 表达式_1 或_表达式 = 2Nullexpression1 or expression2 = Null

[!注释] IsLike 运算符具有与表中的运算符不同的特定的比较功能。The Is and Like operators have specific comparison functionality that differs from the operators in the table.

IfIf ThenThen

IfIf ThenThen

## 示例Example

``````Dim MyResult, Var1, Var2
MyResult = (45 < 35)    ' Returns False.
MyResult = (45 = 45)    ' Returns True.
MyResult = (4 <> 3)    ' Returns True.
MyResult = ("5" > "4")    ' Returns True.

Var1 = "5": Var2 = 4    ' Initialize variables.
MyResult = (Var1 > Var2)    ' Returns True.

Var1 = 5: Var2 = Empty
MyResult = (Var1 > Var2)    ' Returns True.

Var1 = 0: Var2 = Empty
MyResult = (Var1 = Var2)    ' Returns True.

``````